Is there any way to set the maximum number of files, a user is allowed to upload?

Comments

slashrsm’s picture

It is currently not possible to set this.

selfsimilar’s picture

I'd like to see this, too. Mostly I want to use pluploader for the drag and drop functionality, but for single-file uploads.

slashrsm’s picture

Does Plupload library allow this setting?

selfsimilar’s picture

Looking through the Moxiecode Github bugs brought me to this - http://www.plupload.com/punbb/viewtopic.php?id=373. So it's doable, and the code looks pretty small (pasted code below). Ideally the 'max' value should be taken from the associated file field's 'number of values' value, though this won't help me directly since I'm building custom forms for my content types.

...

 /* somewhere here plupload instance is initialized and 
reference assigned to - uploader variable */

...

var max = 3; // max number of files

uploader.bind('FilesAdded', function(up, files) {
    if (files.length > max)
         alert('You are allowed to add only ' + max + ' files.');

    uploader.splice(); // reset the queue to zero
}
slashrsm’s picture

Version: 7.x-1.1 » 7.x-2.x-dev
Category: support » feature

This will probably fit in 7.x-2.x

Elijah Lynn’s picture

Issue summary: View changes
Related issues: +#2007898: Max file count limit