Mime键入Google Chrome中的zip文件 [英] Mime type for zip file in Google Chrome

查看:475
本文介绍了Mime键入Google Chrome中的zip文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我在一个Symfony应用程序

根据 w3school ,zip文件的MIME类型是 application / zip 。这是我相信的。



但是,当我用IE浏览器在Symfony应用程序中上传zip文件时,该zip文件的MIME类型为应用程序/ x-ZIP压缩的。当我在Firefox上传一个zip文件时,该zip文件的MIME类型是 application / octet-stream



他们都不是 application / zip ,因为我想相信。

所有的最奇怪的行为是Google Chrome。当我在Google Chrome中上传一个zip文件时,我无法确定它的正确MIME类型。虽然我 ,可以肯定的是 不是



<$应用程序/压缩
应用程序/ x-zip
应用程序/ octet-stream
应用程序/ x-zip压缩

谷歌浏览器中zip文件的mime类型是一个空字符串,正如我通过倾销 sfValidatorFile 对象返回。请注意,zip文件中的 sfValidatorFile.type 为。



但是为jpeg文件返回的 sfValidatorFile.type 对象是 jpeg



对我来说,好像Symfony或Google Chrome中存在一个bug

更多信息:似乎Gmail在Google Chrome中将zip文件的MIME类型解释为application / zip。这是正确的行为。似乎证实它是Symfony的bug。

解决方案

截至目前,zip文件的MIME类型为 application / octet谷歌浏览器中的<-stream> 。 :)

I discovered a weird issue in zip file's mime type when I worked on a Symfony application.

According to w3school, the mime type for zip file is application/zip. This is what I believe, too.

But when I upload a zip file in my Symfony app with IE, the mime type of that zip file is application/x-zip-compressed. When I upload a zip file in Firefox, the mime type of that zip file is application/octet-stream.

None of them is application/zip as I would like to believe.

The weirdest behavior of all, is Google Chrome. When I upload a zip file in Google Chrome, I can't determine the correct mime type for it. Although I am pretty sure that it's not

application/zip   
application/x-zip
application/octet-stream
application/x-zip-compressed

The mime type for zip file in Google Chrome is an empty string, as I found out by dumping out the sfValidatorFile object returned. Note the sfValidatorFile.type is "" for zip file.

But the sfValidatorFile.type object returned for a jpeg file is jpeg.

Seems to me like there is a bug in either Symfony or Google Chrome

Futher info: It seems that Gmail interprets zip file's mime type as application/zip in Google Chrome. This is the correct behavior. Seems to confirm that it's Symfony's bug.

解决方案

As of now, MIME type of a zip file is application/octet-stream in Google Chrome. :)

这篇关于Mime键入Google Chrome中的zip文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆