我試圖刷新頁面後,多個文件已用jquery file upload上傳:如何等待多個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();
...
})
不幸的是這是行不通的,由於事實fileuploadcompleted事件處理程序不計算有錯誤的文件(如文件過小等) – Paul 2012-07-21 14:37:16
坦率地說,那麼,這個插件似乎並不像最健壯的解決方案我已經使用了很多Uploadify,它有你想要的選項,但這取決於你。 – 2012-07-21 21:46:40