0

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
                )

        )

)
4
  • did you RTM? php.net/manual/en/features.file-upload.errors.php Commented Aug 7, 2015 at 12:56
  • rename the image which is not uploading and try again. use a simple name for the image Commented Aug 7, 2015 at 13:22
  • Renaming a file does not help. Now I try to find the cause using phpinfo() Commented Aug 7, 2015 at 13:27
  • 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. Commented Dec 31, 2018 at 10:51

2 Answers 2

0

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

Sign up to request clarification or add additional context in comments.

6 Comments

upload_max_filesize:100M post_max_size:100M The error occurs only when uploading certain images (other images that are larger or smaller or the same size / resolution / extension) do not cause errors. Renaming the image does not help. 1 of 25 images that I downloaded from the Internet and tried to upload caused the error, and the other is normal uploading. size of all images ~40-60 КByte
By the way, server has Suhosin Extension, I'll try to find a solution in this direction.
If you pic the image that gives you error and you reupload it, do you still get that error or is that a more "positional" issue (let's say it begins to fail after 20 uploads)?
Issue happens every time when I can try to upload problem image, regardless of the order in which I upload it.
can you try to upload another image with the same width/height to see if it fails? The best attempt you can do BTW is disable Suhosin and make an upload attempt but dunno if you have enough perms
|
0
            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);
             }

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.