My problem is simple and complex same time:
Im tryin to upload files using jQuery fileUpload library with spring mvc controller as server side, but my files are bein
You may want to try Programmatic file upload instead. The send
method will ensure only one request is issued.
Basically keep a filelist
variable, update it everytime fileuploadadd
callback happens, then use this filelist
for the send
method.
For example:
$document.ready(function(){
var filelist = [];
$('#form').fileupload({
... // your fileupload options
}).on("fileuploadadd", function(e, data){
for(var i = 0; i < data.files.length; i++){
filelist.push(data.files[i])
}
})
$('#button').click(function(){
$('#form').fileupload('send', {files:filelist});
})
})
It is inspired by this question.
The reason I found it useful is even if you set singleFileUploads
to false
, if you do multiple individual selections, they will still be sent with individual requests each, as the author said himself in this GitHub issue