This worked for me, in the definition of your file upload add beforesend and do a check
var maxfiles=3;
$('#fileupload').fileupload(({
url: postFileUrl,
submit: function (event, files) {
var fileCount = files.originalFiles.length;
if (fileCount > maxFiles) {
alert("The max number of files is "+maxFiles);
throw 'This is not an error. This is just to abort javascript';
return false;
}
}
});
this throw is far from elegant, if you decide to implement it and find a way to avoid this, please let me know (at the moment it is necessary or it will display an error warning for each downloaded file)
source
share