Continue work on FileUpload. Created FileController
This commit is contained in:
parent
b93f0254a6
commit
0263c0f838
5 changed files with 69 additions and 7 deletions
9
motorradig/public/js/app.js
vendored
9
motorradig/public/js/app.js
vendored
|
|
@ -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);
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue