开发者

What is correct content-type for excel files? [duplicate]

开发者 https://www.devze.com 2023-01-01 07:22 出处:网络
This question already has answers here: What is a correct MIME type for .docx, .pptx, etc.? (9 answers)
This question already has answers here: What is a correct MIME type for .docx, .pptx, etc.? (9 answers) 开发者_运维技巧Closed 8 years ago.

I want excel files on a website to open in Excel when clicked, not get saved on desktop, or get opened embedded in a browser etc. Now obviously it all depends on how everything is configured for each user, but what's the best Content-Type and other settings to achieve just that most of the time?


For BIFF .xls files

application/vnd.ms-excel

For Excel2007 and above .xlsx files

application/vnd.openxmlformats-officedocument.spreadsheetml.sheet


application/vnd.ms-excel
  • vnd class / vendor specific
  • http://en.wikipedia.org/wiki/Microsoft_Excel#File_formats


Do keep in mind that the file.getContentType could also output application/octet-stream instead of the required application/vnd.openxmlformats-officedocument.spreadsheetml.sheet when you try to upload the file that is already open.

0

精彩评论

暂无评论...
验证码 换一张
取 消