File Upload: Create Folder

This commit is contained in:
tschneider 2020-02-07 12:53:22 +01:00
parent 81f32f2d09
commit 86d49e5f20
10 changed files with 185 additions and 48 deletions

View file

@ -27,15 +27,24 @@
<div>
<form>
<span>UPLOAD:</span>
<input name="filename" type="file" @change="onFileSelected"></input>
</form>
</div>
<div style="background-color:darkmagenta;">
<p>&nbsp; .....<br/></p>
</div>
<div style="background-color: cyan;">
<input @change="createFolderRequest" type="text"></input><button>Neuen Ordner erzeugen</button>
</div>
</div>
</div>
@ -130,8 +139,6 @@
//formData.append('image',selectedFile,selectedFile.name);
formData.append('image',selectedFile);
const config=
axios.post('http://localhost:8000/api/v1/auth/upload',formData,{
headers: {
'Authorization': 'Bearer ' + this.$store.state.user_token,
@ -141,6 +148,23 @@
.then(res=>{
console.log(res);
})
},
createFolderRequest(event) {
var folderName=event.target.value;
console.log("Request creation of folder:"+folderName);
const formData = new FormData();
formData.append("folder", folderName);
axios.post('http://localhost:8000/api/v1/auth/create_folder',formData,{
headers: {
'Authorization': 'Bearer ' + this.$store.state.user_token,
'Content-Type': 'multipart/form-data'
}
})
.then(res=>{
console.log(res);
})
}
}
}