I'm trying to solve one problem: I want to upload to my website XLS/XLSX file. And I've there for it this condition:
if((mime_content_type($file) == 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' || mime_content_type($file) == 'application/vnd.ms-excel') && ($extension == 'xls' || $extension == 'XLS' || $extension == 'xlsx' || $extension == 'XLSX')){...upload...}
When I use the XLS/X file (which has been saved directly from MS Excel), it works great. But when I want to upload XLS/X file - which has been saved directly from LibreOffice (not as ODS, but as an XLS/X) - it doesn't work and I can't upload this file.
Thanks for any help!
(And the condition with application/vnd.oasis.opendocument.spreadsheet doesn't work as well.)
Update: Thanks to Dipanwita Kundu I was able to find, which MIME type is used (application/octet-stream
) - but its safe to put this as the condition?
mime_content_type($file)
& check the result. – Dipanwita Kundumime_content_type
& allowing file based on mime type, so it has the same risk like other mime type – Dipanwita Kunduapplication/octet-stream
any more. Now it'sapplication/zip
because someone thought that made sense. – Daniel Quinn