Continue work on FileUpload. Created FileController

This commit is contained in:
Torsten 2020-02-05 17:04:01 +01:00
parent b93f0254a6
commit 0263c0f838
5 changed files with 69 additions and 7 deletions

View file

@ -2181,6 +2181,15 @@ __webpack_require__.r(__webpack_exports__);
onFileSelected: function onFileSelected(event) {
console.log("File changed:");
console.log(event.target.files[0].name);
var fd = new FormData();
fd.append('image', event.target.files[0], event.target.files[0].name);
axios.post('http://localhost:8000/api/v1/auth/upload', fd, {
headers: {
'Authorization': 'Bearer ' + this.$store.state.user_token
}
}).then(function (res) {
console.log(res);
});
}
}
});