diff --git a/octoprint/static/js/ui.js b/octoprint/static/js/ui.js index 12cc4ed..df5359b 100644 --- a/octoprint/static/js/ui.js +++ b/octoprint/static/js/ui.js @@ -2136,6 +2136,18 @@ $(function() { $("#gcode_upload_progress .bar").text(""); } + function gcode_upload_fail(e, data) { + $.pnotify({ + title: "Upload failed", + text: "

Could not upload the file. Make sure it is a GCODE file and has one of the following extensions: .gcode, .gco

Server reported:

" + data.jqXHR.responseText + "

", + type: "error", + hide: false + }); + $("#gcode_upload_progress .bar").css("width", "0%"); + $("#gcode_upload_progress").removeClass("progress-striped").removeClass("active"); + $("#gcode_upload_progress .bar").text(""); + } + function gcode_upload_progress(e, data) { var progress = parseInt(data.loaded / data.total * 100, 10); $("#gcode_upload_progress .bar").css("width", progress + "%"); @@ -2158,6 +2170,7 @@ $(function() { dropZone: localTarget, formData: {target: "local"}, done: gcode_upload_done, + fail: gcode_upload_fail, progressall: gcode_upload_progress }); @@ -2167,6 +2180,7 @@ $(function() { dropZone: $("#drop_sd"), formData: {target: "sd"}, done: gcode_upload_done, + fail: gcode_upload_fail, progressall: gcode_upload_progress }); }