I have a very basic html block, which has a button
to download:
<div id="getImageWrapper">
<div class="image">
<p class="image-name">{{imageName}}</p>
<button class="download-btn" @click="getImage">Download image/s</button>
</div>
</div>
The getImage()
function of the download button fetches an array of image list from the server.
getImage() {
const getImagesUrl = this.$store.state.website + '/api/get-requested-user-Images/';
this.$http.get(getImagesUrl)
.then(function (response) {
console.log(response.data);
})
.catch(function (response) {
console.log(response);
});
}
Response data from the server looks something like this:
[
{
"image": "/media/1492960503_66.jpeg"
},
{
"image": "/media/1492963100_0.jpeg"
}
]
My problem is what to do next so that this array of images is downloaded into the user's device (not as a single zipped file, but as separate single image files) which would work in most browsers? If it helps, I am using Django as the backend and Vuejs for the front-end.