本文介绍了获取Microsoft 10 Edge浏览器Mime类型的php的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当检查在Microsoft 10的Edge浏览器中上载的文件的mime类型时,我得到.doc文件的这种Mime类型:

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?

在其他浏览器上,我得到application/msword

On other browsers I get application/msword

是否为Edge浏览器的.doc文件提供了一种处理mime类型的新方法,也许还有我需要注意的其他mime类型?

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?

更新:

我正在使用php的$_FILES['uploadName']['type']

推荐答案

我发现,通过使用它,我得到了正确的mime类型:

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:

这篇关于获取Microsoft 10 Edge浏览器Mime类型的php的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-16 23:32
查看更多