Getting Microsoft 10 Edge browser Mime Types php

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.

链接地址: http://www.djcxy.com/p/47034.html

上一篇: 嵌入Base64图像

下一篇: 获取微软10边缘浏览器MIME类型的PHP