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. |
|
For starters it's just so easy to design an app in a way that I'm used to i.e. database first then views followed by customization. The fork system is pure brilliance from a developer standpoint as I can override things and still add and update my projects with minimal effort! Truly amazing to be able to build components in Joomla using incremental refinement without having to do everything by hand. Thanks for the great tool! I am so much more productive now than ever and I can't imagine building components any other way!!!!
Dave (Forum)
