When checking the file mime types of files being uploaded in Microsoft 10's Edge browser, I get this Mime Type for .doc
files:
application/octet-stream
Apparently this indicates "arbitrary binary data": Do I need Content-Type: application/octet-stream for file download?
On other browsers I get application/msword
Is there a new way mime types are handled for .doc files for the Edge browser, and maybe other mime types I need to be aware of?
Update:
I was grabbing the mime type using php's $_FILES['uploadName']['type']
I found that by using this instead, I get the correct mime type:
$finfo = new finfo(FILEINFO_MIME_TYPE);
$mimeType = $finfo->file($_FILES['uploadName']['tmp_name'][$key]);
And as Martin mentioned in a comment above:
You should not grab the MIME type from the data given in $_FILE as this is extremely flaky and up for interpretation, as you are experiencing. Instead, do a new analysis of the uploaded temporary file, Use finfo() or similar.
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