我正在寻找使用插件上传多个文件的具体示例(使用ctrl + click在单个窗口中选择多个文件)。现在我将上传页面作为一个拨号框并使用我正在使用的form.ajaxsubmit:
$(document).ready(function() {
$('#dialog').dialog({
autoOpen: false,
modal: true,
draggable: false,
resizable: false
});
$('#upload-document-dialog').dialog({
autoOpen: false,
width: 600,
modal: true,
draggable: false,
resizable: false,
buttons: {
"cancel": function() {
$(this).dialog("close");
$("#FileUploadDocumentForm")[0].reset();
$('#UploadDocumentAlertTR').hide();
$('#ajaxUploaderForDocument').hide();
},
"upload": function() {
var fileName = $("#fileInput").val();
if (fileName == null || $('#fileInput').val().length == 0) {
$('#UploadDocumentAlertTD').text('Please specify a document to upload');
return false;
}
//setting some values here for the action class
disableDialogButtons();
$('#FileUploadDocumentForm').ajaxSubmit(FileUploadDocumentFormOptions);
return false;
}
}
}).parent().find('.ui-dialog-titlebar-close').hide();
});
</script>
<div id="upload-document-dialog" title="Upload Document">
<form id="FileUploadForm" name="FileUploadForm" method="post" scope="request"
action="<html:rewrite module='/common' action='/FileUpload'/>"
enctype="multipart/form-data">
<tr>
<td colspan="2">
Document: <input id="fileInput_1" type="file" name="file[]" size="60"
title="Browse for a Document to Upload."/>
</td>
</tr>
</form>
</div>
如上所述我使用Ajax提交在动作类中提交表单和表单文件来进行服务器端验证并返回结果。这适用于单个文件上传。但是如何让这个工作用于多个文件上传。我没有太多运气让这件事适合多次上传。请建议我如何做到这一点?
由于