mootools-form-upload
mootools-form-upload copied to clipboard
reset() doesn't remove all upload files
trafficstars
When there is more than 1 file to upload, calling upload.reset() does not clear the upload list fully.
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]);
}
};