diff --git a/etemplate/js/et2_widget_file.js b/etemplate/js/et2_widget_file.js index beeeaffd29..3cf1e6349e 100644 --- a/etemplate/js/et2_widget_file.js +++ b/etemplate/js/et2_widget_file.js @@ -452,9 +452,9 @@ var et2_file = et2_inputWidget.extend( var file_count = this.resumable.files.length; // Remove files from list - for(var i = 0; i < this.resumable.files.length; i++) + while(this.resumable.files.length > 0) { - this.resumable.removeFile(this.resumable.files[i]); + this.resumable.removeFile(this.resumable.files[this.resumable.files.length -1]); } var event = jQuery.Event('upload'); diff --git a/filemanager/js/app.js b/filemanager/js/app.js index 9fceb793ee..befe3bd23c 100644 --- a/filemanager/js/app.js +++ b/filemanager/js/app.js @@ -830,12 +830,17 @@ app.classes.filemanager = AppJS.extend( var widget = this.et2.getWidgetById('upload'); // Override finish to specify a potentially different path - var old_onfinish = widget.options.onFinishOne; + var old_onfinishone = widget.options.onFinishOne; + var old_onfinish = widget.options.onFinish; widget.options.onFinishOne = function(_event, _file_count) { - widget.options.onFinishOne = old_onfinish; self.upload(_event, _file_count, path); }; + + widget.options.onFinish = function() { + widget.options.onFinish = old_onfinish; + widget.options.onFinishOne = old_onfinishone; + } // This triggers the upload widget.set_value(files);