sinusGob
sinusGob

Reputation: 4313

What is the correct process to upload S3 object to Database

I have this confusion, on how to upload S3 object that being response from IOS to the server, Im using IOS AWS SDK. Let me give a couple of scenario

Illustration

enter image description here

Once I click next, it will save to S3 using IOS AWSK SDK.

Once saved it will go to this screen

enter image description here

This is where I get confused.

  1. Should I submit the media object to S3 first, and get the response back and then segue it to the next screen, and include it in the POST header?
  2. Should I saved the media object to S3 on the second screen, and do everything on the second screen?

Which method is more efficient?

Upvotes: 0

Views: 63

Answers (1)

Jyotman Singh
Jyotman Singh

Reputation: 11340

There are pros and cons to both the approaches. It really depends on your use case -

First approach -

Pro - Your form posting will take less time as you would have already posted the object to S3.

Con - What if the user decides to leave the form screen without filling it? You would have a waste object on S3 and you would have to delete it separately.

Second approach -

Pro - You'll post the Object to S3 only when the user submits the form. This way you'll not be creating any unnecessary objects on S3.

Con - The user will have to wait longer as both calls are being made serially.

Now if your use case is such that very few users would cancel the form screen then it would make sense to go with the first approach else its better to go with the second approach as its more easy to maintain.

Upvotes: 1

Related Questions