J
J
jazzus2019-07-22 18:46:39
Programming
jazzus, 2019-07-22 18:46:39

How to determine file type?

It is necessary to divide the files into 2 parts - doc and docx. Mimetype in tests showed
docx

application/vnd.openxmlformats-officedocument.wordprocessingml.document

doc
application/msword
How can I reliably determine the type of a file - by mime, extension, or both? Or in another way
Purposes:
Files of site users are in the cloud. I will convert Docx to html, doc has its own logic.
mysql, laravel 5.8, php 7.3 Ubuntu VPS

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Ronald McDonald, 2019-07-22
@jazzus

Define both at the same time, in case of differences, give preference to the MIME definition.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question