var images = [];
let uploader = new Slingshot.Upload("articles");
// file input
let files = document.getElementById("someId").files;
for (let i = 0; i < files.length; i++) {
uploader.send(files[i], function (error, downloadUrl) {
if (!error) {
//save all download urls in an array
images[i] = downloadUrl;
}
});
}
console.log(images);
When I access the images array above after filling it with download urls, it is being empty. Any variable value is lost after the send() block. I would like to store all the download urls in an array, so how do I do this?