Search code examples
javascriptjqueryfine-uploader

Fineuploader limit to a single file


I would like to limit the amount files that can be dropped in the bucket to just a single file. I discovered the validation directive and the itemLimit attribute. However, when I set that to 1, it really doesn't do anything. Here's the code that I use to create the instance of fine upload:

Thanks for the help!

                $(this).fineUploader({
                    request: {
                        endpoint: 'api/endpoint.php'
                    },
                    validation: {
                        itemLimit: 1
                    },
                    autoUpload: true,
                    text: {
                        uploadButton: 'DROP ASSET HERE',
                    },
                    debug: false
                })
                    .on('complete', function(event, id, fileName, response) {

                });

Solution

  • Add multiple: false, to the code, this will limit to a single file.