2013-07-25 5 views
5
$finfo = new finfo(FILEINFO_MIME_TYPE); 
echo $finfo->file($file) 

es gibt:Falscher Typ zurück von finfo

für msg: CDF V2 Dokument, korrupt: application/vnd.ms-excel

: Kann nicht Zusammenfassung info

für .doc lesen

für .docx: application/zip

...

/opt/xampp/etc/mime.types sieht gut aus

eine Idee?

+5

Jedes von Microsofts '. * X' ist tatsächlich eine Zip-Datei mit einer XML-Datei. Versuchen Sie, es zu entpacken und sich selbst zu sehen – AmazingDreams

+0

MIME-Typ Raten ist nur das: Raten. – deceze

Antwort

0

Wie AmazingDreams sagte, sind diese OpenXML in ZIP-Dateien. Wenn Sie entpacken, wird es Ihnen einfach sagen, dass es ein XML ist.

könnten Sie die .htaccess-Dateien AddType so dass Apache sie erkennen kann ... Fügen Sie einfach die folgenden Zeilen in Ihrer .htaccess-Datei im Stammverzeichnis Ihrer Website:

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 

Siehe here für eine Diskussion zum Thema .

Verwandte Themen