我正在设置表单,以便我可以上传多个文件:
<div>
<input type="hidden" name="MAX_FILE_SIZE" value="" id="MAX_FILE_SIZE">
<input type="hidden" name="UPLOAD_IDENTIFIER" value="" id="progress_key">
<input type="file" name="image[]" id="image-0">
</div>
此代码将在onClick上克隆,因此我可以选择更多文件。 问题是,当我尝试上传超过10个文件(例如20或30个文件)时,脚本就会死掉,当我打印$ _Files时,该数组只有10个项目。
Array
(
[image] => Array
(
[name] => Array
(
[0] => Nenufares.jpg
[1] => Nenufares.jpg
[2] => Nenufares.jpg
[3] => Nenufares.jpg
[4] => Nenufares.jpg
[5] => Nenufares.jpg
[6] => Nenufares.jpg
[7] => Nenufares.jpg
[8] => Nenufares.jpg
[9] => Nenufares.jpg
)
[type] => Array
(
[0] => image/jpeg
[1] => image/jpeg
[2] => image/jpeg
[3] => image/jpeg
[4] => image/jpeg
[5] => image/jpeg
[6] => image/jpeg
[7] => image/jpeg
[8] => image/jpeg
[9] => image/jpeg
)
[tmp_name] => Array
(
[0] => /tmp/phpAKZxze
[1] => /tmp/phplRShGv
[2] => /tmp/phpJz64SW
[3] => /tmp/phpBkfMoz
[4] => /tmp/phpraMZBl
[5] => /tmp/phpeqaEgk
[6] => /tmp/phpVwxvFv
[7] => /tmp/phplvYiUS
[8] => /tmp/phpPGhqGr
[9] => /tmp/php5kMZca
)
[error] => Array
(
[0] => 0
[1] => 0
[2] => 0
[3] => 0
[4] => 0
[5] => 0
[6] => 0
[7] => 0
[8] => 0
[9] => 0
)
[size] => Array
(
[0] => 83794
[1] => 83794
[2] => 83794
[3] => 83794
[4] => 83794
[5] => 83794
[6] => 83794
[7] => 83794
[8] => 83794
[9] => 83794
)
)
我在zend方面没有任何验证器可以使用count或其他任何方法阻止它..
答案 0 :(得分:5)
; Maximum number of files that can be uploaded via a single request
max_file_uploads = 20
答案 1 :(得分:0)
max_file_uploads:允许同时上传的最大文件数。从PHP 5.3.4开始,提交时保留空白的上传字段不计入此限制。