使用jquery 文件上传上传多个文件后,我正在尝试刷新页面:
出于某种原因,在每个单独的文件上传完成后都会调用我的测试消息,并且我试图在所有文件上传后只调用一次。这可能吗?
HTML:
<form id="fileupload" action="server/php/" method="POST" enctype="multipart/form-data">
<!-- The fileupload-buttonbar contains buttons to add/delete files and start/cancel the upload -->
<div class="row fileupload-buttonbar">
<div class="span7">
<!-- The fileinput-button span is used to style the file input field as button -->
<span class="btn btn-success fileinput-button">
<i class="icon-plus icon-white"></i>
<span>Add files...</span>
<input type="file" name="files[]" multiple>
</span>
<button type="submit" class="btn btn-primary start">
<i class="icon-upload icon-white"></i>
<span>Start upload</span>
</button>
</div>
</div>
<!-- The loading indicator is shown during file processing -->
<div class="fileupload-loading"></div>
<br>
<!-- The table listing the files available for upload/download -->
<table role="presentation" class="table table-striped"><tbody class="files" data-toggle="modal-gallery" data-target="#modal-gallery"></tbody></table>
</form>
jQuery
$('#fileupload').bind('fileuploadcompleted', function (e, data) {
e.preventDefault();
// I would expect to see this after all files ahve uplaoded but I see it for each file upload ?
alert("Completed");
//location.reload();
...
})