diff --git a/ui/scripts/templates.js b/ui/scripts/templates.js index de9beaf5334..297eb610187 100644 --- a/ui/scripts/templates.js +++ b/ui/scripts/templates.js @@ -110,6 +110,9 @@ title: 'label.action.register.template', docID: 'helpNetworkOfferingName', preFilter: cloudStack.preFilter.createTemplate, + + // Handles POST to upload server + // -- standard action handler won't be called until success() callback fileUpload: { action: function(args) { var fileData = args.fileData; @@ -121,9 +124,10 @@ cache: false, dataType: 'json', processData: false, // Don't process the files - contentType: false, // Set content type to false as jQuery will tell the server its a query string request + contentType: false, // jQuery will tell the server this is a query string request success: function(uploadData, textStatus, jqXHR) { - args.response.succes(); + // Files uploaded successfully; proceed to handle rest of action + args.response.succes({ data: uploadData }); }, error: function(error) { args.response.error('Error uploading files'); diff --git a/ui/scripts/ui/dialog.js b/ui/scripts/ui/dialog.js index b23fb5699be..98a9dfa5d44 100644 --- a/ui/scripts/ui/dialog.js +++ b/ui/scripts/ui/dialog.js @@ -693,12 +693,12 @@ context: args.context, uploadData: formData, response: { - success: function() { + success: function(successArgs) { $form.find('.loading-overlay').remove(); $form.data('files', null); args.after({ - data: $.extend(data, { uploadData: uploadData }), + data: $.extend(data, { uploadData: successArgs.data }), ref: args.ref, // For backwards compatibility; use context context: args.context, $form: $form