Client side - Implement Uploads
This commit is contained in:
@@ -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")
|
||||
})
|
||||
})
|
||||
})
|
||||
|
@@ -23,8 +23,8 @@
|
||||
<div class="window-button done-upload"><span class="far fa-check-circle"></span></div>
|
||||
<div class="window-button close-upload"><span class="far fa-times-circle"></span></div>
|
||||
<form enctype="multipart/form-data" id="upload-form">
|
||||
<input hidden='true' type="value" name="loc" />
|
||||
<label for="fileInput">Upload file</label>
|
||||
<input hidden='true' type="value" name="loc" id="upload-directory"/>
|
||||
<label for="fileInput" id="fileLabel">Upload file</label>
|
||||
<input type='file' name="fileUpload" id="fileInput" />
|
||||
</form>
|
||||
</div>
|
||||
|
Reference in New Issue
Block a user