Office 2007 MIME 类型有问题,它们在 IE 中下载为 *.zip 所有其他浏览器都正常
我们有一个在 Tomcat 上运行的自定义 CMS,我们添加了以下配置:
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet .xlsx
我可以在 FF、OP、Chrome、Safari 中毫无问题地下载这些 Excel 2007 文件。但在 IE 中我得到了一个 ZIP 文件的下载框。我更改了 IE8 设置以识别文件扩展名中的文件类型,之后 IE8 将文件显示为纯文本。
问题是,我们的一个大客户被限制只能使用 IE,因此目前他们唯一的解决方案是在上传文件之前压缩文件并在下载后解压缩文件。但这不是真正的解决方案。
这里有人能为我提供解决方案吗?
我们使用 Apache 2.2 和 Tomcat 5.5
We have a custom CMS running on Tomcat, we added the following config:
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet .xlsx
I can download those Excel 2007 Files without Problems in FF, OP, Chrome, Safari. But in IE I get a Download Box for a ZIP File. I changed IE8 Settings to recognize Filetypes from Fileextension, after that IE8 displays the File as plain text.
Problem, one of our bigger customers are restricted to only use IE, so at the moment the only solution for them is to zip the files before they upload them and unzip them after download. But that is not a real solution.
Anybody here with a solution for me?
We are using Apache 2.2 and Tomcat 5.5
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
使用 Fiddler 确认 Content-Type 标头已发送到浏览器。如果不是,请确保问题中列出的 mime 类型已在 web.xml 中正确列出。还要确认该文件是由 Tomcat 而不是 apache 提供的 - 这可以通过在浏览器发出请求后检查服务器上的访问日志来验证。
Use Fiddler to confirm that the Content-Type header is being sent to the browser. If it is not, then make sure the mime type listed in the question is properly listed in web.xml. Also confirm the file is being served by Tomcat and not apache - which can be verified by checking the access logs on bother servers after the browser makes the request.
时,类似的测试对我来说效果很好。
当我显式键入response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
在我的 servlet 中.... Tim 或 WireShark 建议的 Fiddler 可能对于查看正在提供的内容非常有用
Similar tests work fine for me when I explicitly type
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
in my servlet.... Also Fiddler as suggested by Tim or WireShark might be very useful to see what's being served