Microsoft Office 2007 Files Downloading as .Zip Files

November 13, 2008 by  
Filed under Code Snippets

A colleague IMed me earlier today. She was wondering why her .xlsx document was downloading as a strange .zip file. She had uploaded it into the content management system correctly, but when she tried to test it out, the file looked corrupted.

Albert did some digging around and figured that the Microsoft Office 2007 files extensions were not recognized by Apache. So downloading files like .xlsx, .docx, .pptx, etc. will translate to file.zip instead. I did some further browser testing and noticed this problem only appears in IE browsers. It works perfectly in Firefox, Chrome, and Safari.

To fix this problem, you would need to add the extensions to the Apache config file.

Step 1: Make sure you back up your configuration file (httpd.conf in Apache) or (apache2.conf in Apache2)

Step 2: Search for the section with the AddType keywords.

Step 3: Add the following lines:


# MIME type fix
AddType application/vnd.openxmlformats-officedocument.spreadsheetml.sheet .xlsx
AddType application/vnd.openxmlformats-officedocument.wordprocessingml.document .docx
AddType application/vnd.openxmlformats-officedocument.presentationml.slideshow .pptx

If you load other Microsoft Office 2007 files on your Apache web server, you may want to add additional file extensions.

Thanks for figuring it out Albert! That solved the mystery behind two work tickets today.

Sources: Albertech.net, MS Office 2007 File Extensions at WebmasterWorld

Related Products:

Apache: Inside the Cockpit of the World's Most Deadly Fighting MachineApache: Inside the Cockpit of the World's Most Deadly Fighting MachineApache is the incredible true story of Ed Macy, a decorated Apache helicopter pilot, that takes you inside the cockpit of the world’s most dangerous... Read More >
Apache 3 Mil Letter Size (9 x 11.5") Crystal Clear Universal Thermal Laminating Pouches, 100 CountApache 3 Mil Letter Size (9 x 11.5") Crystal Clear Universal Thermal Laminating Pouches, 100 Count

Apache 100 Pack of 3 Mil Letter Size Thermal Laminator Pouches

These pouches are 9x11.5" in size. This is the correct size for st... Read More >

Microsoft Surface Pro 4 SU3-00001 12.3-Inch Laptop (2.2 GHz Core M Family, 4GB RAM, 128 GB flash_memory_solid_state, Windows 10 Pro), SilverMicrosoft Surface Pro 4 SU3-00001 12.3-Inch Laptop (2.2 GHz Core M Family, 4GB RAM, 128 GB flash_memory_solid_state, Windows 10 Pro), SilverMicrosoft Surface Pro 4 is the tablet that can replace your laptop. Featuring a 6th Gen Intel Core M processor with 4GB memory and a 128GB solid state... Read More >
Related Posts Plugin for WordPress, Blogger...