PHP 一次只能看到 20 个上传文件
当我尝试一次上传超过20个文件时,Web服务器只看到前20个。任何其他文件都将被忽略。问题出在哪里?
要尝试的简单代码:
<form action="index.php" method="post" enctype="multipart/form-data">
<?php
if($_FILES){
print_r($_FILES);
}
else{
for($i = 0; $i < 30; $i++)
{
echo '<input type="file" name="file'.$i.'"><br/>';
}
}
?>
<input type="submit" value="go">
</form>
print_r()
输出:
Array ( [file0] => Array ( [name] => 39442.jpg [type] => image/jpeg [tmp_name] => W:\tmp\phpD42.tmp [error] => 0 [size] => 274217 ) [file1] => Array ( [name] => 39442.jpg [type] => image/jpeg [tmp_name] => W:\tmp\phpD52.tmp [error] => 0 [size] => 274217 ) [file2] => Array ( [name] => 39442.jpg [type] => image/jpeg [tmp_name] => W:\tmp\phpD73.tmp [error] => 0 [size] => 274217 ) [file3] => Array ( [name] => 39442.jpg [type] => image/jpeg [tmp_name] => W:\tmp\phpD83.tmp [error] => 0 [size] => 274217 ) [file4] => Array ( [name] => 39442.jpg [type] => image/jpeg [tmp_name] => W:\tmp\phpD94.tmp [error] => 0 [size] => 274217 ) [file5] => Array ( [name] => 39442.jpg [type] => image/jpeg [tmp_name] => W:\tmp\phpDB4.tmp [error] => 0 [size] => 274217 ) [file6] => Array ( [name] => 39442.jpg [type] => image/jpeg [tmp_name] => W:\tmp\phpDC5.tmp [error] => 0 [size] => 274217 ) [file7] => Array ( [name] => 39442.jpg [type] => image/jpeg [tmp_name] => W:\tmp\phpDE5.tmp [error] => 0 [size] => 274217 ) [file8] => Array ( [name] => 39442.jpg [type] => image/jpeg [tmp_name] => W:\tmp\phpDF5.tmp [error] => 0 [size] => 274217 ) [file9] => Array ( [name] => 39442.jpg [type] => image/jpeg [tmp_name] => W:\tmp\phpE06.tmp [error] => 0 [size] => 274217 ) [file10] => Array ( [name] => 39442.jpg [type] => image/jpeg [tmp_name] => W:\tmp\phpE26.tmp [error] => 0 [size] => 274217 ) [file11] => Array ( [name] => 39442.jpg [type] => image/jpeg [tmp_name] => W:\tmp\phpE37.tmp [error] => 0 [size] => 274217 ) [file12] => Array ( [name] => 39442.jpg [type] => image/jpeg [tmp_name] => W:\tmp\phpE57.tmp [error] => 0 [size] => 274217 ) [file13] => Array ( [name] => 39442.jpg [type] => image/jpeg [tmp_name] => W:\tmp\phpE68.tmp [error] => 0 [size] => 274217 ) [file14] => Array ( [name] => 39442.jpg [type] => image/jpeg [tmp_name] => W:\tmp\phpE78.tmp [error] => 0 [size] => 274217 ) [file15] => Array ( [name] => 39442.jpg [type] => image/jpeg [tmp_name] => W:\tmp\phpE98.tmp [error] => 0 [size] => 274217 ) [file16] => Array ( [name] => 39442.jpg [type] => image/jpeg [tmp_name] => W:\tmp\phpEB9.tmp [error] => 0 [size] => 274217 ) [file17] => Array ( [name] => 39442.jpg [type] => image/jpeg [tmp_name] => W:\tmp\phpEC9.tmp [error] => 0 [size] => 274217 ) [file18] => Array ( [name] => 39442.jpg [type] => image/jpeg [tmp_name] => W:\tmp\phpEE9.tmp [error] => 0 [size] => 274217 ) [file19] => Array ( [name] => 39442.jpg [type] => image/jpeg [tmp_name] => W:\tmp\phpEFA.tmp [error] => 0 [size] => 274217 ) )
.htaccess: php_value max_file_uploads 100 - 无济于事
ini_set('max_file_uploads', 100) - doesn't help
我刚刚在我的本地服务器上添加了php.ini行:
max_file_uploads = 100
而且它很有帮助。但我不认为托管商在客户端的Web服务器上更改它。如果不进行编辑,此值将是非常酷的效果。php.ini