我们如何将文件添加到存储桶中的内部文件夹?如果有一个名为user
的存储桶 - >我想将其添加到文件夹images/selected/
。请帮忙。
答案 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];
希望这会有所帮助。干杯,特隆德