Seite 1 von 1

readfile und Office 2007

Verfasst: Fr 12. Mär 2010, 06:51
von achiboy
Auf meiner Seite werden die Downloads mit readfile ausgelesen.

Code: Alles auswählen

 
             header("Content-Type: application/octet-stream");
              header('Content-Disposition: attachment; filename="' . $obj_file->get("filename"). '"');
              header("Content-Transfer-Encoding: binary");
              header("Cache-Control: private",true);
              header("pragma: no-cache"); 
              header("expires: 0");  
              readfile($cfgClient[$client]["upl"]["path"] . $obj_file->get("dirname") . $obj_file->get("filename"));
Das hat alles wunderbar funktioniert.
Nur wenn ich xlsx oder docx Dateien herunterlade, sind diese fehlerhaft.
Was ist an solchen Dateien anders?
Was muss ich machen, um auch diese verarbeiten zu können?

Re: readfile und Office 2007

Verfasst: Fr 12. Mär 2010, 07:15
von idea-tec

Code: Alles auswählen

header('Content-type: application/vnd.openxmlformats-officedocument.wordprocessingml.document');
header('Content-Disposition: attachment; filename="myfile.docx"');
readfile('myfile.docx');

Re: readfile und Office 2007

Verfasst: Fr 12. Mär 2010, 08:27
von achiboy
besten Dank für die rasche Hilfestellung.
Ich habe eine Liste der Mime-Types gefunden:
.docm,application/vnd.ms-word.document.macroEnabled.12
.docx,application/vnd.openxmlformats-officedocument.wordprocessingml.document
.dotm,application/vnd.ms-word.template.macroEnabled.12
.dotx,application/vnd.openxmlformats-officedocument.wordprocessingml.template
.potm,application/vnd.ms-powerpoint.template.macroEnabled.12
.potx,application/vnd.openxmlformats-officedocument.presentationml.template
.ppam,application/vnd.ms-powerpoint.addin.macroEnabled.12
.ppsm,application/vnd.ms-powerpoint.slideshow.macroEnabled.12
.ppsx,application/vnd.openxmlformats-officedocument.presentationml.slideshow
.pptm,application/vnd.ms-powerpoint.presentation.macroEnabled.12
.pptx,application/vnd.openxmlformats-officedocument.presentationml.presentation
.xlam,application/vnd.ms-excel.addin.macroEnabled.12
.xlsb,application/vnd.ms-excel.sheet.binary.macroEnabled.12
.xlsm,application/vnd.ms-excel.sheet.macroEnabled.12
.xlsx,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
.xltm,application/vnd.ms-excel.template.macroEnabled.12
.xltx,application/vnd.openxmlformats-officedocument.spreadsheetml.template