Problem to upload image files

I try to upload image files (jpg, gif…) for shop logo or products item.

The error is …It is not allowed to create/upload/rename files of the application/octet-stream MIME type.

Pls help !!!

Hello lagos,



Thank you for the message.



It seems that the problem occurred because of a minor bug in your store. In order to fix it, please replace the following part of the code:


if (!is_array($filtered[$id]) || !empty($filtered[$id]['path']) && in_array(mime_content_type($filtered[$id]['path']), Registry::get('config.forbidden_mime_types'))) {





with this one:


if (!empty($filtered) && (!is_array($filtered[$id]) || !empty($filtered[$id]['path']) && in_array(fn_get_mime_content_type($filtered[$id]['path']), Registry::get('config.forbidden_mime_types')))) {





replace the following part of code:


$mime = mime_content_type($filtered[$id]['path']);





with this one:


$mime = fn_get_mime_content_type($filtered[$id]['path']);





and replace the following part of code:


?>




with this one:


function fn_get_mime_content_type($filename)
{
if (class_exists('finfo')) {
$finfo_handler = finfo_open(FILEINFO_MIME);
$type = @finfo_file($finfo_handler, $filename);
list($type) = explode(';', $type);
finfo_close($finfo_handler);
} elseif (function_exists('mime_content_type')) {
$type = mime_content_type($filename);
} else {
if (strpos(basename($filename), '.') !== false) {
$type = fn_get_file_type(basename($filename));
} else {
$type = 'text/plain';
}
}

return $type;
}

?>






in the “fn.fs.php” file located in the “core” directory of your CS-Cart installation.





Anastasiya Kozlova

CS-Cart Support Team

Thank you Anastasiya, for your replay.

I look to fn.fs.php file in core directory. I have the right code for the first and second and when i replace the third code to the end of file and save, i can't load the main page of my shop.

Maybe i must try differens else.

Thank again

Hello lagos,



Thank you for the reply.



The problem requires the investigation on your server. Please contact us via Customer Help Desk and provide temporary access to your server.





Pavel Zyukin

CS-Cart Support team