Skip to content

Commit

Permalink
MDL-72966 File upload: Uncaught Error from JS when uploading the file
Browse files Browse the repository at this point in the history
  • Loading branch information
JBThong committed Nov 15, 2021
1 parent d135a12 commit ec160a9
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/form/dndupload.js
Expand Up @@ -863,7 +863,8 @@ M.form_dndupload.init = function(Y, options) {
*/
notifyUploadCompleted: function() {
require(['core_form/events'], function(FormEvent) {
FormEvent.notifyUploadCompleted(this.filemanagerhelper.filemanager.get('id'));
const elementId = this.filemanagerhelper ? this.filemanagerhelper.filemanager.get('id') : this.options.containerid;
FormEvent.triggerUploadCompleted(elementId);
}.bind(this));
},

Expand All @@ -872,7 +873,8 @@ M.form_dndupload.init = function(Y, options) {
*/
notifyUploadStarted: function() {
require(['core_form/events'], function(FormEvent) {
FormEvent.notifyUploadStarted(this.filemanagerhelper.filemanager.get('id'));
const elementId = this.filemanagerhelper ? this.filemanagerhelper.filemanager.get('id') : this.options.containerid;
FormEvent.triggerUploadStarted(elementId);
}.bind(this));
},

Expand Down

0 comments on commit ec160a9

Please sign in to comment.