当检查在Microsoft 10的Edge浏览器中上载的文件mime类型的文件时,我得到.doc文件的Mime类型:
application/octet-stream
显然,这表示“任意二进制数据”:Do I need Content-Type: application/octet-stream for file download?
在其他浏览器上,我得到application / msword
是否有一种新方法为Edge浏览器处理.doc文件的mime类型,以及我需要注意的其他mime类型?
更新:
我使用PHP的$_FILES [‘uploadName’] [‘type’]抓取mime类型
我发现通过使用它,我得到了正确的mime类型:
原文链接:https://www.f2er.com/windows/441501.html$finfo = new finfo(FILEINFO_MIME_TYPE); $mimeType = $finfo->file($_FILES['uploadName']['tmp_name'][$key]);
正如马丁在上面的评论中提到的那样:
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.