这是我的问题说明代码!我的真实项目是想做多个上传文件,但一次上传不超过24个文件。 但我的问题是文件上传一次只能发送20个文件,甚至上传了20多个文件如果我上传21个文件我想要21个,如果22个得到22个......等等!我该如何处理这个问题?
<form action="sessions.php" enctype="multipart/form-data" method="POST">
<ul id="attachment_list">
<li><input type="file" name="attachments[]" class="carte-attachment" multiple></li>
</ul>
<input type="submit">
</form>
<script type="text/javascript">
$("#attachment_list").on("change",".carte-attachment",function(){
$('#attachment_list').append('<li><input type="file" name="attachments[]" class="carte-attachment" multiple></li>');
});
</script>
sessions.php
<?php
var_dump(count($_FILES["attachments"]["name"]); //always print 20 even more than 20 files
?>
最佳答案
为了保护服务器免受 DOS 等攻击,允许上传的最大文件数受到限制。
不过,您可以设置一个指令来增加允许的最大文件数量(默认为 20):max_file_uploads
指令
Added "max_file_uploads" INI directive, which can be set to limit the number of file uploads per-request to 20 by default, to prevent possible DOS via temporary file exhaustion. (Ilia) (changelog for PHP 5.3.1)
关于javascript - 总是上传 20 个甚至超过 20 个文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38650831/