Which MIME type is correct for the .exe file?

2020-08-09 08:17发布

问题:

I try to find which MIME type corresponds to the each extension and I get ambiguous results.

According to webdesign.about.com the correct MIME for exe is: application/octet-stream

According to freeformatter.com the correct MIME for exe is: application/x-msdownload and it says that application/octet-stream is MIME for bin extension.

According to iana.org the correct MIME for exe (or something called vnd.microsoft.portable-executable as I don't see exe there) is: application/vnd.microsoft.portable-executable

Which website is the most accurate because I don't know what kind of content type value I should expect on the server site in the HTTP header.

回答1:

application/vnd.microsoft.portable-executable is a registered MIME type and its description matches what you want to use it for.

The x- prefix in application/x-msdownload indicates that it is experimental so it should generally be avoided: Especially if something standard is available as it in in this case.

application/octet-stream is for arbitary collections of bytes. It does match an executable file, but it isn't as specific as application/vnd.microsoft.portable-executable.

Use application/vnd.microsoft.portable-executable.