Why is the MIME type different when using different PCs, but with the same configuration?

I created a function to check the file extension and the imported Excel file. I have the same source on two different PCs.

PC-1 configuration:

  • Win 7 64bit
  • XAMPP with PHP 7.0.x
  • Google Chrome Browser
  • Installed Microsoft Office 2013

PC-2 configuration:

  • Win 10 64bit
  • XAMPP with PHP 7.1.x
  • Google Chrome Browser
  • Installed Open Office. Do not install MS Office

My Excel file was created in Google Spreadsheet and exported as an MS Office file with the extension .xlsx.

In PC-1, when I debug a value $_FILES['file']['type'];, I get the extension:

'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'

But on PC-2 I got:

'application/octet-stream'

My question is: why with the same source, the same import file, only in different environments, does the debug output output a different file extension? Is the reason for installing MS Office?

+4
1

, Microsoft 2.
Chrome , .
- - .
, , .

0

Source: https://habr.com/ru/post/1671954/


All Articles