My use case.
- I upload 5 images to the s3 server in the browser and get that images uploaded urls.
- Pass that urls to the back-end.
This is my async function
try{
    await uploadImagesToS3(imagesArray);
    await saveUrlsInBackend();
}catch(error){
}
In my uploadImagesToS3 function I'm trying to do something like this.
uploadImagesToS3(){
    resolve(FORLOOP)
}
After for loop run 5 times I want to resolve it to the my main async function.
This my real uploadImagesToS3 function
onUpload(array, albumName) {
      return new Promise((resolve, reject) => {
        resolve(
          for (let index = 0; index < array.length; index++) {
          var files = document.getElementById(array[index]).files;
          if (!files.length) {
            return alert("Please choose a file to upload first.");
          }
          var file = files[0];
          var fileName = file.name;
          var albumPhotosKey = encodeURIComponent(albumName) + "//";
          var photoKey = albumPhotosKey + fileName;
          self;
          s3.upload(
            {
              Key: photoKey,
              Body: file,
              ACL: "public-read"
            },
            (err, data) => {
              if (err) {
                return alert(
                  "There was an error uploading your photo: ",
                  err.message
                );
              }
              // alert("Successfully uploaded photo.");
              this.images[index].image_path = data.Location;
            }
          );
        }
        );
      });
    }
But it doesn't let me to use a for loop inside a resolve function. How could I achieve this async await mechanisms?
 
     
    