mootools-form-upload icon indicating copy to clipboard operation
mootools-form-upload copied to clipboard

reset() doesn't remove all upload files

Open rustyx opened this issue 10 years ago • 1 comments
trafficstars

When there is more than 1 file to upload, calling upload.reset() does not clear the upload list fully.

rustyx avatar May 30 '15 19:05 rustyx

This seems to be due to a bug in this code:

        self.reset = function() {
            var files = inputFiles.getFiles();
            for (var i = 0; i < files.length; i++){
                inputFiles.remove(files[i]);
            }
        };

This essentially deletes only half of the entries.

To fix it, replace with:

        self.reset = function() {
            var files = inputFiles.getFiles();
            for (var i = files.length - 1; i >= 0; i--){
                inputFiles.remove(files[i]);
            }
        };

rustyx avatar May 30 '15 19:05 rustyx