up vote 6 down vote favorite

On my Apache server I have stored several docx, xlsx pptx files.

Some client browsers think that theses are regular zip files and change the file extension when downloading. How do I make it not do that anymore.

(Using Ubuntu server)

link|flag

4 Answers

up vote 15 down vote

The files are actually ZIPs of XML documents. Add this to your .htaccess in Apache

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
link|flag
1  
there's a typo in the first line. It should just be docm with no . – daveilers Jun 3 '09 at 19:07
Fixed. Thanks. – Kevin Kuphal Jun 3 '09 at 19:16
up vote 1 down vote

The server doesn't have proper mime types set up for the new ms file types

add the following to the /etc/mime.types file and restart apache and the problem should be fixed.

# Added by myname 2009-06-03
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    
application/vnd.openxmlformats-officedocument.spreadsheetml.template    xltx

http://www.webdeveloper.com/forum/showthread.php?t=162526 has information about this problem

link|flag
since this is my server and I have access to /etc/mime.types this is the best answer for me. – daveilers Jun 3 '09 at 19:11
up vote 0 down vote

Sounds like your web server is looking at the magic numbers inside these files and seeing that they ARE zip files.

Have a look at: http://www.webdeveloper.com/forum/showthread.php?t=162526

link|flag
up vote 0 down vote

Installed Apache 2.2.14 on Win XP with "apache_2.2.14-win32-x86-no_ssl.msi" and these are already included in ..\Apache\conf\mime.types - BUT - I am getting the same error - dialog box opens and the name is the calling file (index.php) - otherwise this download script has been working okay on my *nix hosted sever.

link|flag

Your Answer

get an OpenID
or
never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.