PHP see only 20 uploading files at a time

后端 未结 8 1391
面向向阳花
面向向阳花 2020-11-29 10:48

When I try to upload more than 20 files at a time, then the web server see only first 20. Any other files are just ignored. What is the problem?

Simple code to try:<

相关标签:
8条回答
  • 2020-11-29 11:27

    If you run PHP as Apache module you might want to change it at virtual host level (aka httpd.conf). You need to remember that, being a PHP_INI_SYSTEM directive, you have to use php_admin_value (regular php_value will be ignored). Sample code could be:

    <Location "/api">
        php_admin_value max_file_uploads 250
    </Location>
    
    0 讨论(0)
  • 2020-11-29 11:37

    Step 1: If you are working on localhost with Xampp server than open xampp control panel click on config button than open php.ini

    Step 2: find max_file_uploads=20

    Step 3: Change value 20 with custom value

    Step 4: Save this php.ini file and close

    Step 5: restart your Apache server by clicking stop and than click on start wait for green color background means apache started successfully

    Final test by uploading file using your code

    0 讨论(0)
  • 2020-11-29 11:39

    There are limits as to how much PHP can post. See the upload_max_filesize, max_file_uploads, and post_max_size directives.

    0 讨论(0)
  • 2020-11-29 11:43

    You can create php.ini file in your website directory on hosting, and write this in it:

    max_file_uploads = 400

    This is allowed way to overwrite php.ini on most hostings (but not in localhost XAMP, etc.) as far as I tried

    0 讨论(0)
  • 2020-11-29 11:45

    There is a limit set to 20 by the max_file_uploads configuration option.

    http://de3.php.net/manual/en/ini.core.php#ini.max-file-uploads

    0 讨论(0)
  • 2020-11-29 11:47

    Recently I came across the same issue, but unfortunately none of the above solutions worked for me. So I think I must share the worked solution here

    When I was trying to upload 50+ images, the server was limiting it to 20. (I was working on a Centos Server with PHP 5.3.6)

    Setting max_file_uploads = 100 in PHP.ini file didn't help even but the number file upload limit changed to 25

    On searching the numeric value 25 in the phpinfo() page, I came across a parameter suhosin.upload.max_uploads with value 25.

    Setting suhosin.upload.max_uploads to 100 along with max_file_uploads = 100 in the PHP.ini file worked, now on the server we can upload upto 100 files. (I am not sure if we have any other file where we modify the values suhosin parameters , but setting suhosin values in either php.ini OR php.d/suhosin.ini will work :) )

    max_file_uploads = 100    
    suhosin.upload.max_uploads=100
    

    http://www.hardened-php.net/suhosin/configuration.html

    0 讨论(0)
提交回复
热议问题