AWS S3 Bucket - Add a file to the internal folder using the AWS SDK

How to add a file to an internal folder in a bucket? If there is a bucket named user โ†’, I want to add it to the images/selected/ folder. Please, help.

+4
source share
1 answer

This is what I do to upload the local file (localfilename.txt) to S3 and put the files in the โ€œ 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

+6
source

Source: https://habr.com/ru/post/1383618/


All Articles