I know Dropzone supports the possibility to limit the file size to a certain number of MB (through maxFilesize) but is there a way to add a minFilesize ? This is because I don't want empty files to reach the server.
I see this is the point in the plugin which determines what to do with the file in case of a too big file size:
Dropzone.prototype.accept = function (file, done) {
if (file.size > this.options.maxFilesize * 1024 * 1024) {
return done(this.options.dictFileTooBig.replace("{{filesize}}", Math.round(file.size / 1024 / 10.24) / 100).replace("{{maxFilesize}}", this.options.maxFilesize));
} else if (!Dropzone.isValidFile(file, this.options.acceptedFiles)) {
return done(this.options.dictInvalidFileType);
} else if ((this.options.maxFiles != null) && this.getAcceptedFiles().length >= this.options.maxFiles) {
done(this.options.dictMaxFilesExceeded.replace("{{maxFiles}}", this.options.maxFiles));
return this.emit("maxfilesexceeded", file);
} else {
return this.options.accept.call(this, file, done);
}
};
I know I could add an extra else if here to treat the minFilesize scenario but I'd like to stay out of the plugin's code and only do this 'externally' if possible, through the events emmited by the plugin.
Is this possible ?
file.sizecondition instead will do the trick.