Response fixes
This commit is contained in:
10
README.md
10
README.md
@@ -51,7 +51,7 @@ Requests:
|
||||
}
|
||||
```
|
||||
|
||||
Responses (Only for directory traversals):
|
||||
Responses (View directory):
|
||||
|
||||
```javascript
|
||||
{
|
||||
@@ -68,6 +68,14 @@ Responses (Only for directory traversals):
|
||||
}
|
||||
```
|
||||
|
||||
Responses(Rename/Move Success,Upload)
|
||||
|
||||
```javascript
|
||||
{
|
||||
'loc':"<new location>"
|
||||
}
|
||||
```
|
||||
|
||||
## Credit
|
||||
|
||||
- Samuel Thornton: [Material Design Box Shadows]("https://codepen.io/sdthornton/pen/wBZdXq")
|
||||
|
2
index.js
2
index.js
@@ -106,7 +106,7 @@ app.post('/files/upload',(req,res,next)=>{
|
||||
//Make sure uploadable location is in required directory
|
||||
if(processing.inDir(settings.dirname,loc)){
|
||||
fs.createReadStream(oloc).pipe(fs.createWriteStream(loc))
|
||||
res.json({"done":"Uploaded"})
|
||||
res.json({"loc":nloc.path})
|
||||
}
|
||||
else{
|
||||
throw new Error("Not in directory")
|
||||
|
@@ -131,14 +131,13 @@ $(document).ready(()=>{
|
||||
})
|
||||
$(".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)
|
||||
alert("Uploaded")
|
||||
closeUploadWindow();
|
||||
},
|
||||
error:msg=>alert("Error")
|
||||
|
Reference in New Issue
Block a user