Reputation: 3409
How can we add a file to an inner folder in a bucket? If there is a bucket named user
--> i want to add it to the folder images/selected/
. Please help.
Upvotes: 4
Views: 2474
Reputation: 2456
This is what I do to upload a local file (localfilename.txt) to S3 and place files in 'folders' (image/selected/s3filename.txt).
AmazonCredentials * credentials = [[AmazonCredentials alloc] initWithAccessKey:ACCESS_KEY_ID withSecretKey:SECRET_KEY];
putObjectRequest = [[[S3PutObjectRequest alloc] initWithKey:@"images/selected/s3filename.txt" inBucket:@"user"] autorelease];
[putObjectRequest setFilename:@"localfilename.txt"];
[putObjectRequest setCredentials:credentials];
[[AmazonClientManager s3] putObject:putObjectRequest];
Hope this helps. Cheers, Trond
Upvotes: 6