I'm using Jquery File Uploadify plugin for Document upload which has multiple true, When i use alert in OnComplete function is showing multiple alerts when uploading the documents..
function loadSwf(){
$("#fileuploader").fileUpload({
'uploader': "@Url.Content("~/Scripts/FileUpload/uploader.swf")",
'cancelImg': "@Url.Content("~/Content/Images/clearBtn.png")",
'buttonText': 'Browse Files',
//'buttonImg' : "@Url.Content("~/Content/Images/attachDoc.png")",
'script': "@Url.Content("~/Documents/Upload/")",
'folder': "@Url.Content("~/Documents/")",
//'fileDesc': 'Documents Files',
'fileExt': '*.pdf;*.doc;*.ppt;*.xls',
'multi': true,
'auto': false,
'scriptData': {'ActivityID': $('[id="ActivityID"]').val(), 'Description' : "test" },
'onComplete': function(settings, data) {
alert("File Uploaded Successfully");
}
});
}
This code is working fine for uploading one file. But when i upload multiple files I am getting that alert message for each file !! How to get that alert message only once after uploading all files, instead of one alert per file.
You need to use onQueueComplete event
$("#fileuploader").fileUpload({
'uploader': "@Url.Content("~/Scripts/FileUpload/uploader.swf")",
'cancelImg': "@Url.Content("~/Content/Images/clearBtn.png")",
'buttonText': 'Browse Files',
//'buttonImg' : "@Url.Content("~/Content/Images/attachDoc.png")",
'script': "@Url.Content("~/Documents/Upload/")",
'folder': "@Url.Content("~/Documents/")",
//'fileDesc': 'Documents Files',
'fileExt': '*.pdf;*.doc;*.ppt;*.xls',
'multi': true,
'auto': false,
'scriptData': {'ActivityID': $('[id="ActivityID"]').val(), 'Description' : "test" },
'onQueueComplete' : function(queueData) {
alert("Files Uploaded Successfully");
}
}
});