简体   繁体   中英

setMaxFiles to upload in dropzone.js

I want to set the maximum number of files reached in dropzone.js by setting the 'maxfilesreached' property as follows:

 maxfilesreached: function () {
      alert("Max Files reached")
  }

It is not firing on reaching maximum files.

How to trigger this event?

NOTE: I am using this dropzone.js in ASP.NET MVC

Here is the Simple Code to Set Maximum Numbers of File

<form class="File" id="my-file"></form>

and JS:

File.options.my-file = {
maxFiles: 1,
accept: function(file, done) {
console.log("uploaded");
done();
 },
init: function() {
this.on("maxfilesexceeded", function(file){
    alert("No more files please!");
});
 }
};

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM