PHP: Set max_file_uploads for one file rather than php.ini

僤鯓⒐⒋嵵緔 提交于 2020-01-01 05:39:13

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!