PHP - finfo_file returns incorrect MIME type -
i have application can upload/download files different format. when upload have correct mime type, when download same file, finfo_file of php returns me incorrect mime type. here values got :
code :
$finfo = finfo_open(fileinfo_mime_type); $mime_type = finfo_file($finfo, $filename); echo $mime_type;
output :
application/msword // test0.pot incorrect should application/vnd.ms-powerpoint text/plain // test1.csv icnorrect should text/csv application/vnd.ms-powerpoint // test2.pptx incorrect should application/vnd.openxmlformats-officedocument.presentationml.presentation application/msword // test3.pps incorrect should application/vnd.ms-powerpoint application/msword // test4.docx incorrect should application/vnd.openxmlformats-officedocument.wordprocessingml.document application/msword // test5.doc correct application/vnd.ms-excel // test6.xls correct application/vnd.ms-excel // test7.xlsx incorrect should application/vnd.openxmlformats-officedocument.spreadsheetml.sheet application/msword // test8.docm incorrect should application/vnd.ms-word.document.macroenabled.12 application/pdf // test9.pdf correct
i checked apache's mime.types file, mime types correct. there configuration have ? can me fix ?
thanks.
i did , works better :
code :
$finfo = finfo_open(fileinfo_mime, "conf/magic"); $mymime = finfo_file($finfo, $filename);
thanks anyway.
Comments
Post a Comment