0
votes

I have a form with works well (upload) for many image files and with diferente size.

But some images are not uploaded to the server.

Problem images have empty $_FILE[name][tmp_name] and $_FILE[name][error] == 8.

In the same time other images (which have a larger or smaller file size) uploading properly.

Have you any ideas?


Thanks.

print_r($_FILES) for normal image

FILES:Array
(
    [img] => Array
        (
            [name] => Array
                (
                    [0] => 1320600215_0_284da_78d5c77a_xl.jpg
                )

            [type] => Array
                (
                    [0] => image/jpeg
                )

            [tmp_name] => Array
                (
                    [0] => /var/www/test/data/mod-tmp/phpoqm4qR
                )

            [error] => Array
                (
                    [0] => 0
                )

            [size] => Array
                (
                    [0] => 126867
                )

        )

)



print_r($_FILES) for problem image
FILES:Array
(
    [img] => Array
        (
            [name] => Array
                (
                    [0] => 94689121_1GPPZgCqPmI.jpg
                )

            [type] => Array
                (
                    [0] => 
                )

            [tmp_name] => Array
                (
                    [0] => 
                )

            [error] => Array
                (
                    [0] => 8
                )

            [size] => Array
                (
                    [0] => 0
                )

        )

)
2
rename the image which is not uploading and try again. use a simple name for the imageNeel Ion
Renaming a file does not help. Now I try to find the cause using phpinfo()Bell8
I got the same problem, getting error 8 when trying to upload with move_uploaded_file function. My upload script worked well for 5 years, but suddenly stopped working. [photo1] => Array ( [name] => offf.jpg [type] => [tmp_name] => [error] => 8 [size] => 0 ) I used phpinfo() and found out the script, according to error number 8, which is causing problem to my upload is "suhosin" which can be something else in your case. I contacted my server admin for help and asked if they have installed "suhosin" recently.user1540647

2 Answers

0
votes

Hi error code 8 means:

 UPLOAD_ERR_EXTENSION

    Value: 8; A PHP extension stopped the file upload. PHP does not provide a way to ascertain which extension caused the file upload to stop; examining the list of loaded extensions with phpinfo() may help. Introduced in PHP 5.2.0.

Things that may help:

  1. check if your server has some extra security modules installed that may limit file uploading (eg.Suhosin gives a lot of these issues)

  2. check if your max_upload_filesize and post_max_size params are properly set

  3. try to check if this issue happens with some specific file (eg. big files, for some extensions or some filenames) or if it's completely random

0
votes
            if (isset($_FILES['files']) && !empty($_FILES['files'])) 
             {
                  date_default_timezone_set("asia/kolkata");
                  $image=date("YmdHis")."_".$_FILES['files']['name'];
                  move_uploaded_file($_FILES['files'] 
                  ['tmp_name'],"uploads/business/".$image);
             }