diff --git a/README.md b/README.md index ac21577..c54a4f3 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ Dependencies(testing): `chai` `mocha` `chai-http` - [x] Folder Traversal - [X] File Downloads - [X] File Moving -- [ ] Upload +- [X] Upload ### Why diff --git a/static/base.js b/static/base.js index e3fe639..ed2ecec 100644 --- a/static/base.js +++ b/static/base.js @@ -125,4 +125,23 @@ $(document).ready(()=>{ }) } }) + $("#fileInput").change((e)=>{ + console.log(e.target.files) + $("#fileLabel").html(e.target.files[0].name); + }) + $(".done-upload").click(()=>{ + $("#upload-directory").val(currDir.loc) + //$("#theForm").ajaxSubmit({url: '/files/upload', type: 'post'}) + $.ajax("/files/upload",{ + method: 'post', + processData:false, + contentType:false, + data:new FormData(document.getElementById('upload-form')), + success:msg=>{ + alert(msg.done) + closeUploadWindow(); + }, + error:msg=>alert("Error") + }) + }) }) diff --git a/static/index.html b/static/index.html index 20c7111..6d87f99 100644 --- a/static/index.html +++ b/static/index.html @@ -23,8 +23,8 @@