2
I have moved a site from one server to the other. I am using this tool to upload files: here. Now on the new server, when selecting more than one file I cannot upload the image, that is, it is not even loaded in the window. Will be some missing php module on the new server?
In the log file, gives the following error:
PHP Warning: exif_imagetype(): Filename cannot be Empty in /path_file/server/php/Uploadhandler.php on line 462
Code of line 462:
if (function_exists('exif_imagetype')) {
switch(exif_imagetype($file_path)){ // ESTA É A LINHA 462
case IMAGETYPE_JPEG:
$extensions = array('jpg', 'jpeg');
break;
case IMAGETYPE_PNG:
$extensions = array('png');
break;
case IMAGETYPE_GIF:
$extensions = array('gif');
break;
}
// Adjust incorrect image file extensions:
if (!empty($extensions)) {
$parts = explode('.', $name);
$extIndex = count($parts) - 1;
$ext = strtolower(@$parts[$extIndex]);
if (!in_array($ext, $extensions)) {
$parts[$extIndex] = $extensions[0];
$name = implode('.', $parts);
}
}
The problem at the beginning is not the code, since in the other server worked all right.
Did you even search the server logs? Any error messages in the console?
– brasofilo
I didn’t get to search, but I saw it now and it’s in the following file: Uploadhandler.php on line 462
– pc_oc
Okay, line 462, but then what? The error msg is just that?
– brasofilo
line 462 has the following: switch(exif_imagetype($file_path)) I will update the question and I will add a larger code snippet. thank you
– pc_oc
Well, then I’d say it’s not the
exif_imagetype
, because it passed the conditionif exists
. It seems that the error is earlier, who sends the$file_path
is sending incomplete information. Can go back and look for who sends it?– brasofilo
Place the line on which "$file_path" is declared...
– Mukotoshi
$file_path is receiving the value here: $upload['tmp_name'][$index]
– pc_oc
@brasofilo , this value is coming from another function. The point is that this code worked on another server and not on this one, so the problem is not the starting code
– pc_oc
OK, it’s just trying to locate which function/resource is causing the problem
– brasofilo
Just a guess based on the comments: what are the values of the parameters
post_max_size
andupload_max_filesize
in your php.ini? What size file are you trying to upload?– gabrielhof
@gabrielhof, I am testing with small files. The point is that the first image goes well but when it goes to the second not.
– pc_oc
What about the parameter
max_file_uploads
in php.ini?– gabrielhof
The error is certainly in this function that is called, it is returning an empty "$file_path", can you post this function? If you cannot, check the function line by line to try to find out what is happening...
– Mukotoshi
@gabrielhof does not have this parameter in php.ini
– pc_oc
@Mukotoshi, the problem should not be the code, since on the other server the same code worked. I must have some restriction to limit the number of uploads..
– pc_oc
Then try to set the value of
max_file_uploads
for 10 or more. Anything, check the documentation: http://php.net/manual/en/ini.core.php#ini.max-file-uploads– gabrielhof
Have you checked the same directories? From what I understand $file_path is coming empty... Maybe a directory configuration or something like that.
– Fernando