File(image) upload and storage
This commit is contained in:
parent
0263c0f838
commit
81f32f2d09
7 changed files with 43 additions and 19 deletions
|
|
@ -125,11 +125,17 @@
|
|||
onFileSelected(event) {
|
||||
console.log("File changed:");
|
||||
console.log(event.target.files[0].name);
|
||||
const 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];
|
||||
const formData = new FormData();
|
||||
//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
|
||||
'Authorization': 'Bearer ' + this.$store.state.user_token,
|
||||
'Content-Type': 'multipart/form-data'
|
||||
}
|
||||
})
|
||||
.then(res=>{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue