IE changes docx, xlsx, pptx to zip while downloading

Wednesday, January 21, 2009

Microsoft Office 2007 has introduced some new file formats like docx, xlsx, pptx etc. One docx/xlsx/pptx file is actually a collection of many files, stored in an archive (zip-file).

When these files are downloaded by the Internet Explorer from a webserver, the extension of the file may be changed to "zip". (To open this file, you just need to change the extension to the correct one)

This problem can be fixed at the webserver level by adding the MIME type of the new extensions.

For Tomcat, add the MIME types in the conf/web.xml file, as given below.

<mime-mapping>
<extension>docx</extension>
<mime-type>application/vnd.openxmlformats-officedocument.wordprocessingml.document</mime-type>
</mime-mapping>

<mime-mapping>
<extension>xlsx</extension>
<mime-type>application/vnd.openxmlformats-officedocument.spreadsheetml.sheet</mime-type>
</mime-mapping>

<mime-mapping>
<extension>pptx</extension>
<mime-type>application/vnd.openxmlformats-officedocument.presentationml.presentation</mime-type>
</mime-mapping>



For Apache, add the MIME types in the conf/httpd.conf file, as given below -

AddType application/vnd.openxmlformats-officedocument.wordprocessingml.document docx
AddType application/vnd.openxmlformats-officedocument.presentationml.presentation pptx
AddType application/vnd.openxmlformats-officedocument.spreadsheetml.sheet xlsx

0 comments: