Depending on the use case, how do I constrain the number of files that dropzone.js will allow?
For example, I might need to only allow 1, 2, or 4 files uploaded.
It's not uploadMultiple
. Unfortunately, uploadMultiple
only applies to the number of files handled per request.
maxFiles: 1
does the job but if you also want to remove the additional files you can use this sample code taken from the Wiki page:How can I limit the number of files?
I thought that the most intuitive single file upload process was to replace the previous file upon a new entry.
You can also add in callbacks - here I'm using Dropzone for Angular
The problem with the solutions provided is that you can only upload 1 file ever. In my case I needed to upload only 1 file at a time (on click or on drop).
This was my solution..
Hope this helps ;)
it looks like maxFiles is the parameter you are looking for.
https://github.com/enyo/dropzone/blob/master/src/dropzone.coffee#L667