Created
January 3, 2014 00:43
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//#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