jQuery File Upload - Angularjs

Asked

Viewed 161 times

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?

  • I didn’t get to search, but I saw it now and it’s in the following file: Uploadhandler.php on line 462

  • Okay, line 462, but then what? The error msg is just that?

  • 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

  • Well, then I’d say it’s not the exif_imagetype, because it passed the condition if 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?

  • Place the line on which "$file_path" is declared...

  • $file_path is receiving the value here: $upload['tmp_name'][$index]

  • @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

  • OK, it’s just trying to locate which function/resource is causing the problem

  • 2

    Just a guess based on the comments: what are the values of the parameters post_max_size and upload_max_filesize in your php.ini? What size file are you trying to upload?

  • @gabrielhof, I am testing with small files. The point is that the first image goes well but when it goes to the second not.

  • 1

    What about the parameter max_file_uploads in php.ini?

  • 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...

  • @gabrielhof does not have this parameter in php.ini

  • @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..

  • 1

    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

  • Have you checked the same directories? From what I understand $file_path is coming empty... Maybe a directory configuration or something like that.

Show 12 more comments

1 answer

1

Point 1: Do an "echo" of the value of $upload['tmp_name'][$index] to see what you have

Point 2: Check well that you are recovering value with $_FILE because from PHP5, simply use input name does not work but

Point 3: Check that you put Multiple in HTML et enctype multipat in the FORM tag (enctype="Multipart/form-data")

Also to receive but from a document, you should read the list with

 $_FILES[$nome_input]['tmp_name'][$x]

$x depends on document number.

Good luck

Browser other questions tagged

You are not signed in. Login or sign up in order to post.