2009-10-30 18 views
2

背景:由於某些原因,無論用戶何時嘗試使用MSIE從我們的Intranet打開xslx(excel 2007)文件,文件下載對話框都會將其解釋爲「zip」文件。Apache配置MIME類型:xlsx文件在下載時被解釋爲zip文件,爲什麼?

不可否認,xslx文件真的壓縮文件,但我們不希望這種行爲。請在Excel中打開。

問:

火狐,OTOH,通常打開的文件。是否有可能是我的apache配置錯誤?或者這是一個客戶端瀏覽器的問題?

回答

2

原因是IE的奇怪的MIME嗅探行爲:http://msdn.microsoft.com/en-us/library/ms775147.aspx。它基本上試圖通過查看文件的內容來確定文件的文件類型,比如Linux的file工具。

+0

所以mime.types文件,你會知道,是有辦法禁用這個或重新配置瀏覽器來停止這種行爲? – dreftymac 2009-10-30 00:59:12

3

您必須在網絡服務器端添加一些新的MIME-TYPES。

comment-thread on this windowsnerd.com page(2009年):

一下添加到.htaccess文件,並把它扔在你的網站:將AddType 應用/ vnd.openxmlformats .DOCX .PPTX的.xlsx .xltx。 xltm .dotx .potx .ppsx

應該解決許多問題。

或者,你可以將它添加到位於你的Apache Web服務器的config目錄

application/vnd.ms-word.document.macroEnabled.12 .docm 
application/vnd.openxmlformats-officedocument.wordprocessingml.document docx 
application/vnd.openxmlformats-officedocument.wordprocessingml.template dotx 
application/vnd.ms-powerpoint.template.macroEnabled.12 potm 
application/vnd.openxmlformats-officedocument.presentationml.template potx 
application/vnd.ms-powerpoint.addin.macroEnabled.12 ppam 
application/vnd.ms-powerpoint.slideshow.macroEnabled.12 ppsm 
application/vnd.openxmlformats-officedocument.presentationml.slideshow ppsx 
application/vnd.ms-powerpoint.presentation.macroEnabled.12 pptm 
application/vnd.openxmlformats-officedocument.presentationml.presentation pptx 
application/vnd.ms-excel.addin.macroEnabled.12 xlam 
application/vnd.ms-excel.sheet.binary.macroEnabled.12 xlsb 
application/vnd.ms-excel.sheet.macroEnabled.12 xlsm 
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet xlsx 
application/vnd.ms-excel.template.macroEnabled.12 xltm 

http://www.webdeveloper.com/forum/showthread.php?t=162526