title: Retrofit + AWS S3 - Presigned URL uploading multiple images, should I use a loop with PUT requests?
body: <p>I have a AWS Lambda function that a user makes a <code>GET request</code> to and it returns presigned URL. The user then uploads an image by making a PUT request to that URL. Since AWS S3 <code>PUT requests</code> limits object uploads to only one per URL, </p>
  
  <p>How would I send multiple images? Am I supposed to use a loop on the current number of images e.g: </p>
  
  <p>Say the user wants to upload 5 images. </p>
  
  <pre><code>for(...5 images...){
     Make GET request to generate URL
     In the callback method, 
     Make a PUT request to the generated URL to upload image
  } 
  </code></pre>
  
  <p>I am not sure if the service is supposed to be used this way. And also this causes another issue, say what if I want all the images to be uploaded and saved into my DB, or none to be saved. Because in the <code>PUT request's</code> post process Lambda function, I want to save that S3 image URL into my database, how do I ensure all the images are uploaded and not only 3/5 of them if the network fails?</p>