Skip to content

Instantly share code, notes, and snippets.

@chrisallick
Created January 3, 2014 00:43
Show Gist options
  • Save chrisallick/8230337 to your computer and use it in GitHub Desktop.
Save chrisallick/8230337 to your computer and use it in GitHub Desktop.
This will upload an image to s3 from ios using the amazon library
//#import <AWSS3/AWSS3.h>
//#import <AWSRuntime/AWSRuntime.h>
//import those in your .h file and
//add the awss3 and awsruntime framework from the client
//download from Amazon
AmazonS3Client *s3Client = [[AmazonS3Client alloc] initWithAccessKey:@"Key_Goes_here" withSecretKey:@"Secret_Goes_Here"];
NSString *imageName = [NSString stringWithFormat:@"%@.png", @"cpa"];
S3PutObjectRequest *objReq = [[S3PutObjectRequest alloc] initWithKey:imageName inBucket:@"bucket_name"];
objReq.contentType = @"image/png";
objReq.cannedACL = [S3CannedACL publicRead];
objReq.data = UIImagePNGRepresentation(myFace);
objReq.delegate = self;
[s3Client putObject:objReq];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment