Strange warning accussing any mimetype of not being an image.
gusbemacbe opened this issue · comments
Gustavo Benedetto Papi Muñiz Costa commented
The result is:
File: produto-01.jpeg is not an image. The file is removed!
Your images can be viewed here:
In the config file:
define("R_PATH", __DIR__);
define("F_PATH", R_PATH.'/assets/imagens/produtos');
define("H_FILE", true);
In the file imgupload.class
:
private function check_img_mime($tmpname)
{
$finfo = finfo_open(FILEINFO_MIME_TYPE);
$mtype = finfo_file($finfo, $tmpname);
$this->mtype = $mtype;
if (strpos($mtype, '/assets/imagens/produtos/') === 0)
{
return true;
}
return false;
finfo_close($finfo);
}
The database:
Bjorn commented
This is not an issue, but an error on your own side. You've changed if(strpos($mtype, 'image/') === 0){
to if (strpos($mtype, '/assets/imagens/produtos/') === 0)
, which doesn't work. That line is not a directory line. It's a MIME type. You should NEVER change it.