What I am trying to do is upload multiple files with this code and create array location filled up with location. But when i try to console.log location after the for loop, it returns empty result. Can any one help me with this problem? Uploading S3 worked very well. Just failed to make an array 'location'. Try to solve this problem for 4hours in a row... I would appreciate your help.
var arr = []
const uploadToS3 = async() =>{
var i = 0;
for (i;i<images.length;i++){
var file =
{
name: brandInput.value+"-"+productNameInput.value+"-"+i+".jpg",
type: "image/jpeg",
uri: images[i].uri
}
RNS3.put(file, options).then(response => arr.push(response.body.postResponse.location));
}
}