angelokh
angelokh

Reputation: 9428

Upload file to sub folder under bucket with AWS iOS SDKv2

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;
}];

Upvotes: 3

Views: 3241

Answers (1)

Finch_Powers
Finch_Powers

Reputation: 3126

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.

Upvotes: 12

Related Questions