Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mime type for zip file in Google Chrome

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.

like image 370
Graviton Avatar asked May 13 '09 04:05

Graviton


People also ask

What MIME type is a zip file?

An official list of mime types can be found at The Internet Assigned Numbers Authority (IANA) . According to their list Content-Type header for zip is application/zip . The media type for rar files, registered at IANA in 2016, is application/vnd.

How do I find the MIME type of a file?

For detecting MIME-types, use the aptly named "mimetype" command. It has a number of options for formatting the output, it even has an option for backward compatibility to "file". But most of all, it accepts input not only as file, but also via stdin/pipe, so you can avoid temporary files when processing streams.

What is MIME type of folder?

Introduction. The MIME types file in the config directory contains mappings between MIME (Multipurpose Internet Mail Extensions) types and file extensions. For example, the MIME types file maps the extensions .html and .htm to the type text/html: type=text/html exts=htm,html.

What is the default MIME type?

Two primary MIME types are important for the role of default types: text/plain is the default value for textual files. A textual file should be human-readable and must not contain binary data. application/octet-stream is the default value for all other cases.


1 Answers

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

like image 61
Salman von Abbas Avatar answered Oct 01 '22 23:10

Salman von Abbas