Topic: Limit the number of files a user can upload

Hello

I need to restrict the number of files user can add to uploader.
At the moment, it seems that is adding all the files that user has selected via select file popup.

And even if i delete a files, when i trigger uploader.upload() it is selecting all the files.

uploader.bind('FilesRemoved', function(uploader, files) {
            $.each(files, function(i, file) {
                uploader.removeFile(file);
                $("#" + file.id).remove();
            });
        });

Please help me

2

Re: Limit the number of files a user can upload

use splice, something like this ..

Uploader.bind('FilesAdded', function(up, files) {
   if (up.files.length > 0) {
      up.splice(0, 1);
   }
});

Last edited by cw (2010-06-07 13:50:54)