How to Allow Only One File to Upload in Dropzone?

Admin   Jquery   264  2020-08-13 04:43:59

In this example, i will show you dropzone allow only one file upload. We will look at example of dropzone js accept only one file. i would like to share with you how to allow only one file to upload in dropzone.js. it's simple example of dropzone js allow only one image. you will do the following things for dropzone js allow only one file.

If you have to allow only one file upload in dropzone js then i will help you how to add option to accept only one file in dropzone js. you can easily make solution with jquery, php, laravel and other framework too.

Dropzone JS provide "maxFiles" option there you can set max allow number of file. so you can make 1 as maxFiles in your js code. so let's see bellow code and you can make done your solution.

Solution:

Dropzone.options.imageUpload = {

maxFilesize:10,

maxFiles: 1,

acceptedFiles: ".jpeg,.jpg,.png,.gif"

};

Example:

I hope it can help you...