File(image) upload and storage
This commit is contained in:
parent
0263c0f838
commit
81f32f2d09
7 changed files with 43 additions and 19 deletions
11
motorradig/public/js/app.js
vendored
11
motorradig/public/js/app.js
vendored
|
|
@ -2181,11 +2181,14 @@ __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, {
|
||||
var selectedFile = event.target.files[0];
|
||||
var formData = new FormData(); //formData.append('image',selectedFile,selectedFile.name);
|
||||
|
||||
formData.append('image', selectedFile);
|
||||
var config = axios.post('http://localhost:8000/api/v1/auth/upload', formData, {
|
||||
headers: {
|
||||
'Authorization': 'Bearer ' + this.$store.state.user_token
|
||||
'Authorization': 'Bearer ' + this.$store.state.user_token,
|
||||
'Content-Type': 'multipart/form-data'
|
||||
}
|
||||
}).then(function (res) {
|
||||
console.log(res);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue