Js代码: //批量上传按钮
$('#fileupload').uploadify ({
'swf' : '/CoveragePlaform/media/uploadify-3.2/uploadify.swf',
'uploader' : '',
'cancelImage' : '/CoveragePlaform/media/uploadify-3.2/uploadify-cancel.png',
'buttonClass' : 'btn',
/*'checkExisting' : '{%url check_existing %}',*/
'removeCompleted' : true,
'fileTypeExts' : '*.txt',
'auto' : false,
'multi' : true,
'folder' : 'UploadFile',
//'queueID' : 'uploadfileQueue',
//'fileCount' : 5,
// 'filesSelected' : 5,
'buttonText' : 'em/ec文件上传',
'simUploadLimit ' : 10,
'queueSizeLimit' : 25,
'onUploadStart' : function(file) { },
'onUploadSuccess' : function (file, data, response) {
//alert("success");
// $("#instructions").before("<img src='/media/{{request.user.id}}/"+data+"' />")
} }); }); function uploadifyUpload (){
$("#fileupload").uploadify('upload','*');
//如果参数是.uploadify('upload'),就只能上传一个文件,后面如果加个* 号就是全部上传,这是3.1uploadify的API
}
html:
<input type="file" name="emupload" id="fileupload"> </input>
<br/>
<br/>
<br />
<br />
<!--<a href="javascript:$('#uploadify').uploadifyUpload()">开始上传</a>|-->
<button class="btn" id="upload" onclick="uploadifyUpload()"><strong>运行</strong></button>
【注意】 因为uploadify 是采用多个并发的,会触发多个request .不是一个request上传所有的文件。