TommyDo
TommyDo

Reputation: 673

Why is MIME type different when using different PC but with same config?

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

PC-1 Configuration:

PC-2 Configuration:

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

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

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

Yet on PC-2, I received:

'application/octet-stream'

My question is: Why with same source, same import file, just different environments, does the debug output show a different file extension? Is the cause installing MS Office?

Upvotes: 6

Views: 636

Answers (1)

JGFMK
JGFMK

Reputation: 8904

It's because Microsoft office isn't installed on PC 2.
So it Chrome doesn't know how to interpret.
Octet-stream is a last ditch attempt to interpret.
This post goes into more detail and there's a way you can tweak registry to perhaps achieve same result.

Upvotes: 1

Related Questions