3

I saw an example on s3 ios sdk to upload a file with a key. However, I couldn't find any example to upload a file to sub folders under a bucket. How to specify the sub folders I want to upload to?

AWSS3TransferManagerUploadRequest *uploadRequest = [AWSS3TransferManagerUploadRequest new];
uploadRequest.bucket = yourBucket;
uploadRequest.key = yourKey;
uploadRequest.body = yourDataURL;
uploadRequest.contentLength = [NSNumber numberWithUnsignedLongLong:fileSize];

[[transferManager upload:uploadRequest] continueWithBlock:^id(BFTask *task) {
    // Do something with the response
    return nil;
}];
angelokh
  • 9,426
  • 9
  • 69
  • 139

1 Answers1

12

Subfolders don't really exist in S3. Just define a key containing slashes and the parts between the slashes will be represented with slashes in the web console. Even though you'll see folders, it's only a key name containing slashes.

So here what you want to do is have your key contain the full destination path.

Finch_Powers
  • 2,938
  • 1
  • 24
  • 34