Nick Ginanto
Nick Ginanto

Reputation: 32160

Uploading to s3, with success callback on iOS

This question perhaps can be trivial, be as I am starting with IOS I'm not sure on what to search for.

I have a backend which handles processing of images, and with browser-based uploads, the images get upload directly to a temp folder in the app's bucket in S3, once done, I send the url to the backend for processing of the image in a background worker.

On IOS, I don't understand how and who is responsible for getting the url of the just-uploaded file to the server or to the app along with some meta data (which user uploaded the file, etc)

Looking at an S3 SDK for mobile example https://aws.amazon.com/articles/3002109349624271 I don't see that this is included.

Is that possible? Is that a common practice to do (get the url back from S3 and send it to the server along with meta data)?

Upvotes: 0

Views: 357

Answers (1)

Adeel Ur Rehman
Adeel Ur Rehman

Reputation: 566

The sample code from link in question.

S3PutObjectRequest *putObjectRequest = [[[S3PutObjectRequest alloc] initWithKey:MY_PICTURE_NAME inBucket:MY_PICTURE_BUCKET] autorelease];
putObjectRequest.contentType = @"image/jpeg";
putObjectRequest.data = imageData;

// Now we need to get the response and check the error which was not in the sample code given in the link
S3PutObjectResponse *putObjectResponse = [s3 putObject:putObjectRequest]; 
if (!putObjectResponse.error)
{
    // Send the KEY to server.
}

Let me know if you have any questions.

Upvotes: 1

Related Questions