Mime-type checkBefore to upload a file, your component checks the coherency of the header of a file. It should match with its own known mime-types / extensions pairs. Mime detectionThere are severals possibles ways to detect mime in php. Your component is trying the one it found possible, but it depends of your server configuration. switch($method) { case 'system': if (!function_exists('system')) continue; $mime = system("file -i -b " . $file); break; case 'shell_exec': if (!function_exists('shell_exec')) continue; $mime = trim( @shell_exec( 'file -bi ' . escapeshellarg( $file ) ) ); break; case 'mime_content_type': if (!function_exists('mime_content_type')) continue; $mime = mime_content_type($file); break; case 'finfo_file': if (!function_exists('finfo_file')) continue; $finfo = finfo_open(FILEINFO_MIME); $mime = finfo_file($finfo, $file); finfo_close($finfo); break; case 'image_check': $file_info = getimagesize($file); $mime = $file_info['mime']; break; }
TroubleshootingSpecific file or extensionIf it fails only with a certain type of files, then the problem do not comes from your component. Always failsIf your component always fails to read a mime header: 1. Check your php modules. 2. Disable Mime detection. |
|
Les générateurs de code je les connais presque tous pour les avoir essorés en long en large et en travers ... mais celui ci c'est vraiment un outil formidable de simplicité et d'efficacité !