我们是否可以为添加到S3的文件设置“Content-Language”元数据值?
我看到相互矛盾的答案(即How to upload S3 metadata with a file in Fog? - 说明它应该能够完成)。
到目前为止,我的尝试导致密钥前缀为“x-amz-meta-”,因此密钥最终成为“x-amz-meta-Content-Language”而不仅仅是“Content-Language”。
我正在使用AWSSDK进行C#:
下面是代码片段(非常基本的例子):
var request = new PutObjectRequest
{
BucketName = _bucket,
Key = filekey,
InputStream = stream,
CannedACL = S3CannedACL.PublicRead
};
//Add metaData collection to request
foreach (KeyValuePair<string, string> currentMetaData in metaData)
{
request.Metadata.Add(currentMetaData.Key, currentMetaData.Value);
//WHERE Key = "Content-Language" and Value = "en" (or es, it etc)
}
using (var client = GetS3Client())
{
//WHERE GetS3Client() returns an instance of Amazon.S3.IAmazonS3
client.PutObject(request);
}