function upload(&$model){
if($_SERVER['REQUEST_METHOD'] === 'POST'){
$file = $_FILES['file'];
$file_name = $file['name'];
$file_ext2 = explode('.', $file_name);
$file_extenstion = strtolower(end($file_ext2));
$finfo = finfo_open(FILEINFO_MIME_TYPE);
echo(finfo_file($finfo, $file['tmp_name']));
echo($file['type']);
}
return "superliga_view";
}
Why
echo(finfo_file($finfo, $file['tmp_name']));
prints image/jpeg
, but
echo($file['type']);
prints "image/png"?
I try make watemark, but
$image = imagecreatefrompng($target);
sometimes throws errors due to wrong file type. With small files php always reads them as png, but with large files it reads them as jpeg.