I'm creating an upload VueJS component and I've this portion to display the images in the images object:
<div class="row">
<figure class="col-md-3" v-for="image in images">
<img :src="'/'+image.image" :alt="image.description+'-'+image.image" class="img-responsive"
style="width:100%;">
</figure>
</div>
I want to know if there's a way yo image the images after every successful upload and to get the newly uploaded images.
Here's the the method I'm using to submit the images :
props: ['data'],
data() {
return {
files: [],
slug: this.data.slug,
id: this.data.part.id,
images : this.data.part.images
}
},
methods: {
submitFiles() {
let formData = new FormData();
for (let i = 0; i < this.files.length; i++) {
let file = this.files[i];
formData.append('files[' + i + ']', file);
}
axios.post('/dashboard/galleries/',
formData,
{
headers: {
'Content-Type': 'multipart/form-data'
}
}
).then(function () {
console.log('SUCCESS!!');
})
.catch(function () {
console.log('FAILURE!!');
});
}
Thanks to everyone for helping.
imagesobject after the upload is successful