Warum werden docx-, xlsx- und pptx-Dateien als ZIP-Dateien vom Webserver heruntergeladen?

Warum werden docx-, xlsx- und pptx-Dateien als ZIP-Dateien vom Webserver heruntergeladen?

Auf meinem Apache-Server habe ich mehrere docx-, xlsx- und pptx-Dateien gespeichert.

Manche Client-Browser gehen davon aus, dass es sich um normale ZIP-Dateien handelt und ändern die Dateierweiterung beim Herunterladen. Wie kann ich das verhindern?

(Ubuntu-Server verwenden)

Antwort1

Bei den Dateien handelt es sich eigentlich um ZIP-Dateien von XML-Dokumenten. Fügen Sie diese zu Ihrer .htaccess in Apache hinzu

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

Antwort2

Der Server hat keine geeigneten MIME-Typen für die neuen MS-Dateitypen eingerichtet

Fügen Sie der Datei /etc/mime.types Folgendes hinzu und starten Sie Apache neu. Das Problem sollte behoben sein.

# 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=162526hat Informationen zu diesem Problem

Antwort3

Es hört sich an, als ob Ihr Webserver die magischen Zahlen in diesen Dateien betrachtet und erkennt, dass es sich um ZIP-Dateien handelt.

Schauen Sie sich Folgendes an:http://www.webdeveloper.com/forum/showthread.php?t=162526

Antwort4

Herunterladenhttp://packages.ubuntu.com/oneiric/mime-support, und installieren Sie es mit dpkg -i. Hat super geklappt!

PS: Apache unter Ubuntu und Debian liest aus /etc/mime.types

verwandte Informationen