我有下面的代码应该使用 ajax 将文件发送到服务器,但 jQuery-File-Upload 不发送它。怎么了?我做了文档中的所有操作。
<div id="uploadDialog" title="Import files">
<input id="fileupload" type="file" name="files[]" multiple data-url="/FileReceiver.ashx"
data-sequential-uploads="true" data-form-data='{"script": "true"}'>
<button id="btnUpload">Import</button>
</div>
$('#fileupload')
.bind('fileuploadadd', function (e, data) { alert("0"); })
.bind('fileuploadsubmit', function (e, data) { alert("1"); })
.bind('fileuploadsend', function (e, data) { alert("2"); })
.bind('fileuploaddone', function (e, data) { alert("3"); })
.bind('fileuploadfail', function (e, data) { alert("4"); })
.bind('fileuploadalways', function (e, data) { alert("5"); })
.bind('fileuploadprogress', function (e, data) { alert("6"); })
.bind('fileuploadprogressall', function (e, data) { alert("7"); })
.bind('fileuploadstart', function (e) { alert("8"); })
.bind('fileuploadstop', function (e) { alert("9"); })
.bind('fileuploadchange', function (e, data) { alert("10"); })
.bind('fileuploadpaste', function (e, data) { alert("11"); })
.bind('fileuploaddrop', function (e, data) { alert("12"); })
.bind('fileuploaddragover', function (e) { alert("13"); });
$("#btnUpload").click(function () {
var filesList = $('#fileupload').attr("files");
//1-st variant
$('#fileupload').fileupload('add', { files: filesList, url: '/FileReceiver.ashx' });
//2-nd variant
$('#fileupload').fileupload('send', { files: filesList });
});