aboutsummaryrefslogtreecommitdiff
path: root/qc_app/static/js
diff options
context:
space:
mode:
Diffstat (limited to 'qc_app/static/js')
-rw-r--r--qc_app/static/js/upload_progress.js16
1 files changed, 10 insertions, 6 deletions
diff --git a/qc_app/static/js/upload_progress.js b/qc_app/static/js/upload_progress.js
index d615be4..fdcbe68 100644
--- a/qc_app/static/js/upload_progress.js
+++ b/qc_app/static/js/upload_progress.js
@@ -69,16 +69,20 @@ function upload_data(event) {
event.preventDefault();
var pindicator = document.getElementById("progress-indicator");
- pindicator.setAttribute("class", "modal");
- var form = document.getElementsByTagName("form")[0]
+ var form = document.getElementsByTagName("form")[0];
+ var the_file = form.querySelector("input[type='file']").files[0];
+ if(the_file === undefined) {
+ form.querySelector("#file_upload").parentElement.setAttribute(
+ "class", "invalid-input");
+ return false;
+ }
+ pindicator.setAttribute("class", "modal");
var formdata = setup_formdata(form);
- document.getElementById("progress-filename").innerHTML = (
- form.querySelector("input[type='file']").files[0].name);
+ document.getElementById("progress-filename").innerHTML = the_file.name;
var request = setup_request(
- form.querySelector("input[type='file']").files[0],
- document.getElementById("progress-indicator"));
+ the_file, document.getElementById("progress-indicator"));
request.open(form.getAttribute("method"), form.getAttribute("action"));
request.send(formdata);
return false;