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!