maxfileCount在jQuery上载文件中不工作
高级选项卡: 我使用的是jqueryUpload插件的最新文件,我想在这里设置最大10个文件限制,但maxfileCount不起作用maxfileCount在jQuery上载文件中不工作,jquery,cakephp,file-upload,Jquery,Cakephp,File Upload,高级选项卡: 我使用的是jqueryUpload插件的最新文件,我想在这里设置最大10个文件限制,但maxfileCount不起作用 <link href="http://hayageek.github.io/jQuery-Upload-File/uploadfile.min.css" rel="stylesheet"> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"&g
<link href="http://hayageek.github.io/jQuery-Upload-File/uploadfile.min.css" rel="stylesheet">
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script src="http://hayageek.github.io/jQuery-Upload-File/jquery.uploadfile.min.js"></script>
Html和jQuery代码在这里
<script>
$("#document").uploadFile({
url:"<?php echo $this->Html->url(array('controller'=>'evaults','action'=>'action', 'new')); ?>",
multiple:true,
dragDrop:true,
showFileCounter:false,
fileName:"doc",
allowedTypes:"pdf,ppt,doc,docx,xls,xlsx",
maxFileSize:5*1024*1024,
autoSubmit:true,
maxfileCount:10,
formData: {filename:'doc'},
showStatusAfterSuccess:false,
dragDropStr:"<span id='comp_doc_name' style='color: #B2B2B2;font-size: 18px; opacity: 1; float:left'>Upload Company Document</span>",
onSuccess: function (files, response, xhr)
{
}
});
</script>
它允许上传超过10个文件。。
脚本中是否还有其他参数或缺少任何内容??
请帮忙,提前谢谢: 我自己解决了
$("#document").uploadFile({
url:"<?php echo $this->Html->url(array('controller'=>'evaults','action'=>'action', 'new')); ?>",
multiple:true,
dragDrop:true,
showFileCounter:false,
fileName:"doc",
allowedTypes:"pdf,ppt,doc,docx,xls,xlsx",
maxFileSize:5*1024*1024,
autoSubmit:true,
// maxfileCount:10, <--- remove this
formData: {filename:'doc'},
showStatusAfterSuccess:false,
dragDropStr:"<span id='comp_doc_name' style='color: #B2B2B2;font-size: 18px; opacity: 1; float:left'>Upload Company Document</span>",
onSelect:function(files) {
var cnt = files.length;
if(cnt <= 10)
{
return true; //to allow file submission.
}
else
{
return false;
}
},
onSuccess: function (files, response, xhr)
{
}
});
可以使用onSelect方法进行文件计数,我们可以设置文件上载限制,MaxFileCount在这段代码中现在是不必要的