Support Home Page › Forums › Joomla Software › Easy File Uploader Module › Error with MIME types? › Re: Error with MIME types?
OK, once again answering my own question… 🙂 No, the MIME type comparison would ignore the charset information in only some of the alternate supported methods. I was able to fix my problem by adding the code stripping out the charset information to the code path using the FILEINFO_MIME method. The code is added after line 213 in the helper function actualMime in the class modEasyFileUploaderHelper in the file helper.php.
The relevant section of code is as follows:
// try to use recommended functions
if (defined(‘FILEINFO_MIME’) &&
function_exists(‘finfo_open’) && is_callable(‘finfo_open’) &&
function_exists(‘finfo_file’) && is_callable(‘finfo_file’) &&
function_exists(‘finfo_close’) && is_callable(‘finfo_close’))
{
$finfo = finfo_open(FILEINFO_MIME);
$mime = finfo_file($finfo, $file);
if ($mime === ”)
{
$mime = false;
}
finfo_close($finfo);
//this removes the charset value if it was returned with the mime type. mime is first.
$mime = strtok($mime, ‘; ‘);
$mime = trim($mime); //remove any remaining whitespace
}
The added code is emphasized.