AWS S3 Bucket - 使用AWS SDK将文件添加到内部文件夹

时间:2011-11-29 11:58:24

标签: iphone amazon-s3 amazon-web-services

我们如何将文件添加到存储桶中的内部文件夹?如果有一个名为user的存储桶 - >我想将其添加到文件夹images/selected/。请帮忙。

1 个答案:

答案 0 :(得分:6)

这是我将本地文件(localfilename.txt)上传到S3并将文件放在“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];

希望这会有所帮助。干杯,特隆德