I am using jquery file upload to upload the files to the server . I want to restrict the user to upload maximum 6 files . I search the wiki jquery file upload but didnt find the parameter for it . Is there any way that i can restrict the user on number of uplaods
Use maxNumberOfFiles
here is documentation :
$('#fileuploadbasic').fileupload({
maxNumberOfFiles: 6
});
maxNumberOfFiles was not working for me so i did the following
$('#fileuploadbasic').fileupload({
change : function (e, data) {
if(data.files.length>=5){
alert("Max 5 files are allowed")
return false;
}
},
maxFileSize: 20000000,
acceptFileTypes: /(\.|\/)(jpe?g|png)$/i,
});
You can limit the uploading files by the "Uploadhandler.php" file .change the "max_number_of_files" option. works for me. But it only validates when you upload the file.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With