Today I learned that Microsoft Office 2007 files (you know, the new ones that end in DOCX, XLSX, and PPTX) don’t always download properly in Internet Explorer. In fact, IE tends to see them as ZIP files and forces their extension to change to .zip when you select download. This is because IE is checking for the MIME type instead of blindly going by file extensions. Ironically, since it doesn’t recognize the new Office 2007 files for what they are, IE renames their extensions to .zip upon downloading.
If you’re wondering why the extensions get changed to .zip, it’s because the new Office 2007 formats are nothing more than a series of XML documents zipped up with their own special file extensions. Java .jar files and Mozilla Firefox .xpi files do mostly the same thing, so this isn’t a new concept, but it does seem to introduce a bit of a problem for Internet Explorer users.
There seem to be a number of “solutions” out there, but many of them involve telling the end user to change a setting in their browser or something like that — definitely not the best solution. Another option is to simply rename the affected file(s) to the appropriate extension(s) and open them up in Office as usual. Although this works, it’s still not a great solution since most users won’t know to do that.
The best solution I found was on a forum, where a user suggested setting the MIME types manually on the server. This is obviously a better solution, since end users get the expected behavior and are able to download files with the proper extension. For Apache servers, simply add the following to your config file or create an .htaccess file in the root directory of your website:
AddType application/vnd.ms-word.document.macroEnabled.12 .docm AddType application/vnd.openxmlformats-officedocument.wordprocessingml.document docx AddType application/vnd.openxmlformats-officedocument.wordprocessingml.template dotx AddType application/vnd.ms-powerpoint.template.macroEnabled.12 potm AddType application/vnd.openxmlformats-officedocument.presentationml.template potx AddType application/vnd.ms-powerpoint.addin.macroEnabled.12 ppam AddType application/vnd.ms-powerpoint.slideshow.macroEnabled.12 ppsm AddType application/vnd.openxmlformats-officedocument.presentationml.slideshow ppsx AddType application/vnd.ms-powerpoint.presentation.macroEnabled.12 pptm AddType application/vnd.openxmlformats-officedocument.presentationml.presentation pptx AddType application/vnd.ms-excel.addin.macroEnabled.12 xlam AddType application/vnd.ms-excel.sheet.binary.macroEnabled.12 xlsb AddType application/vnd.ms-excel.sheet.macroEnabled.12 xlsm AddType application/vnd.openxmlformats-officedocument.spreadsheetml.sheet xlsx AddType application/vnd.ms-excel.template.macroEnabled.12 xltm AddType application/vnd.openxmlformats-officedocument.spreadsheetml.template xltx |
Note that, if you’re updating your main config file, you’ll have to restart Apache before the changes will take affect. With .htaccess files you shouldn’t need to restart the server.
Now your users will be able to download Office 2007 files from your server without any problems. If you’ve discovered another method for solving this problem, please share it in the comments!
여러 방법들이 있으나 그중에 가장 좋은 해결책이라 생각이 든다.
서버측에 .htaccess 를 위와 같이 심어둠으로써 클라이언트가 어떤 ie 버전이든 간에 문제는 해결되기때문이다.
MIME-Types를 주는 방법이다.
하지만 접속하는 서버마다 일일이 두어야 한다는 단점이 있다.
IE의 이 문제를 테스트 해본결과 ie7에서는 정상적이나, ie8에서는 zip으로 받아지기도 하고 ie8에서도 세부 버전따라 정상되기도
하고 그렇다.
IE9에서는 해결이 된 듯 zip으로 저장되는 문제는 발생하지 않는다.
하지만 아직 IE9의 호환성 문제로 섣불리 업데이트 하기는 어렵다.
위 .htaccess 를 서버에 두는 방법으로 일단 해결하면 된다.
아래 파일을 받아서 서버에 업로드 후 파일이름부분만 없애고 .htaccess로 고쳐주자.