我需要有多个与fineuploader 实例相关的事件,但我不知道如何去做。不能将它们添加到 Fineuploader 属性等中吗?那么完整的事件不是称为onComplete吗?有没有存在的例子?另外,我对右括号的数量等感到困惑。当我最初剪切并粘贴这段代码时,有一个额外的 )}; 坐在外面。我删除了它,但我不确定这对于实际代码是否很酷。任何帮助表示赞赏,因为我已经玩了几个小时了。在此代码之外设置了一些变量。
$(document).ready(function () {
var controlType = '@Model.ControlType';
var surveyItemResultId = @Model.Results[0].SurveyItemResultId;
var itemId = @Model.SurveyItemId;
var instance = @Model.Results[0].SurveyInstanceID;
var loopingCounter = 0;
var fineuploader = $('#files-upload').fineUploader({
request:
{
endpoint: '@Url.Action("UploadFile", "Survey")',
customHeaders: { Accept: 'application/json' },
params: {
surveyInstanceId: (function () { return instance; }),
surveyItemResultId: (function () { return surveyItemResultId; }),
itemId: (function () { return itemId; }),
loopingIndex: (function () { return loopingCounter++; })
}
},
validation: {
acceptFiles: ['image/*','application/pdf','text/csv'] ,
allowedExtensions: ['jpeg', 'jpg', 'gif', 'png', 'csv', 'pdf'],
sizeLimit: 1024*1024*1 // 1MB
},
multiple: true,
text: {
uploadButton: '<i class="icon-plus icon-white"></i>Select your upload file(s)'
}
})
.on('complete', function(event, id, fileName, responseJSON) {
alert("Success: " + responseJSON.success);
uploadedFileCounter++;
if (filesToUpload == uploadedFileCounter)
{
alert("DONE UPLOADING!");
}
}).on('submitted', function(event, id, filename) {
filesToUpload++;
alert("submitted: " + filesToUpload);
}
});
});