diff options
author | prashantsinalkar | 2019-07-17 14:56:54 +0530 |
---|---|---|
committer | prashantsinalkar | 2019-09-13 16:21:15 +0530 |
commit | 760c6ef028bd4866a81a9e8f00d6c73f828a276c (patch) | |
tree | 119a0f5cf84a3cc4acae930a3c67d5ea3105187d /website/static/website/js/cloud.js | |
parent | f0860aca1c6233826d3e895d51f452a15d348c0d (diff) | |
download | R_on_Cloud_Web_Interface-760c6ef028bd4866a81a9e8f00d6c73f828a276c.tar.gz R_on_Cloud_Web_Interface-760c6ef028bd4866a81a9e8f00d6c73f828a276c.tar.bz2 R_on_Cloud_Web_Interface-760c6ef028bd4866a81a9e8f00d6c73f828a276c.zip |
added file select validation and varible for upload file api url
Diffstat (limited to 'website/static/website/js/cloud.js')
-rw-r--r-- | website/static/website/js/cloud.js | 54 |
1 files changed, 26 insertions, 28 deletions
diff --git a/website/static/website/js/cloud.js b/website/static/website/js/cloud.js index 9aa3d87..056cac3 100644 --- a/website/static/website/js/cloud.js +++ b/website/static/website/js/cloud.js @@ -1011,49 +1011,47 @@ $(document.body).ready(function() { }); -$(document).on("click", "#fileuploadsubmit", function() { - - if(confirm("Uploaded file last only till sesstion. Use direct file name for execution.")){ - var name = doSubmit(); - $("<span>" + name + "</span>").insertAfter("#uploaddataset"); - $("#uploaddatasetModal").modal('hide'); - $("#uploaddataset").hide(); - } - else{ - return false; + $(document).on("click", "#fileuploadsubmit", function() { + if( document.getElementById("fileSelect").files.length == 0 ){ + alert("No files selected"); + }else{ + if(confirm("Uploaded file last only till sesstion. Use direct file name for execution.")){ + var name = doSubmit(); + $("<span>" + name + "</span>").insertAfter("#uploaddataset"); + $("#uploaddatasetModal").modal('hide'); + $("#uploaddataset").hide(); + } + else{ + return false; + } } + }); - - -}); - -$(document).on("click", "#reset", function() { - if(confirm("Are you sure you want to reset? Reset will clear of your data/uploaded file.")){ - document.location.reload(true); - } - else{ - return false; - } -}); + $(document).on("click", "#reset", function() { + if(confirm("Are you sure you want to reset? Reset will clear of your data/uploaded file.")){ + document.location.reload(true); + } + else{ + return false; + } + }); }); //document.readOnly() function doSubmit(){ // Form Data var formData = new FormData(); - var fileSelect = document.getElementById("fileSelect"); if(fileSelect.files && fileSelect.files.length == 1){ var file = fileSelect.files[0] formData.set("file", file , file.name); - } - - var session_id = document.getElementById("session_id"); + var session_id = document.getElementById("session_id"); formData.set("session_id", session_id.value) - // Http Request + // Http Request var request = new XMLHttpRequest(); - request.open('POST', "http://10.101.201.190:8001/upload"); + request.open('POST', api_url_upload); request.send(formData); return (fileSelect.files[0].name); + } } |