问题
Like many variables in PHP using ini_set() on a page doesn't actually work.
I've recently upgraded my PHP version and found that my multiple image uploader is now capped. After 3 hours of frustration, I've found that my new PHP install has the new "max_file_uploads" parameter set to "20".
So only the first 7 images get uploaded (each is in three sizes, 7*3=21).
I can now change my php.ini value of "max_file_uploads" to 300, but I'd rather not do that side wide.
Is there any way to set that value just for a single file (upload.php)? Could a .htaccess file be used for this?
回答1:
Correction: max_file_uploads can NOT be changed outside php.ini. See PHP "Bug" #50684
回答2:
Yes it can be changed. Use the .htaccess file and add this:
php_value max_file_uploads 40
example, i use this in my .htaccess in the folder:
php_value upload_max_filesize 25M
php_value post_max_size 25M
php_value max_file_uploads 1000
;)
damian rossi
来源:https://stackoverflow.com/questions/2492234/php-set-max-file-uploads-for-one-file-rather-than-php-ini