hello I’m trying to validate an uploaded file type by finfo_file function.
But when a .docx file is sent, the file type is:
application/zip
instead of:
application/vnd.openxmlformats-officedocument.wordprocessingml.document
how can I change this behavior?
As far as I now the vendor specific file types (vnd.) are not standardized (by any RFC) and therefore not covered by file_info().
.docxis a zipped xml-format and thats the reason, whyfile_info()returnsapplication_zip(what is completely right). You may unzip the file and test the mime-type of the result, but that will lead toxml(what is completely correct too) and other files, that are used by the document. To differ between different XML formatsfile_info()had to analyze its content and it must know, how it looks, what goes just to far.