
Jonathan Garcia Lima - 2009-11-15 05:40:11
file -bi sometimes returns the charset with mimetype like "audio/mpeg; charset: binary", so that ruins your mime validation
mime_content_type is deprecated and also brings up the error above in *nix systems, i guess
the fix:
keep the function get_mime_content_type in directory_info class, looking like this:
function get_mime_content_type( $pathtofile ) {
if( !directory_info::valid_pathtofile( $pathtofile ) )
return false;
$finfo = finfo_open(FILEINFO_MIME_TYPE);
$fileMime = finfo_file($finfo, $pathtofile);
finfo_close($finfo);
return $fileMime;
}
just a reminder, this requires: (PHP >= 5.3.0, PECL fileinfo >= 0.1.0)