I need determine what is type of uploaded file
When upload .xlsx
file, this code:
echo $_FILES['uploaded_file']['type']."<br>";
echo mime_content_type($_FILES['uploaded_file']['tmp_name']);
returns:
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
application/vnd.ms-excel
As I know (from here PHP xls, xlsx, ppt, pptx headers), application/vnd.ms-excel
is not .xlsx
, but .xls
file mime type.
So, why returns mime_content_type()
function application/vnd.ms-excel
for .xlsx
file? where the truth?
Use FileInfo instead of mime_content_type (which is deprecated).
Regarding mime-types and extensions,
application/vnd.ms-excel xls xlb xlt
application/vnd.ms-excel.addin.macroEnabled.12 xlam
application/vnd.ms-excel.sheet.binary.macroEnabled.12 xlsb
application/vnd.ms-excel.sheet.macroEnabled.12 xlsm
application/vnd.ms-excel.template.macroEnabled.12 xltm
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet xlsx
(available at /etc/mime.types in your linux webserver)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With