我把文件上传到S3成功地与我的应用程序。 我做一个直接的上传自浏览器的使用signedUrl,我的服务器生成为我作的流程应用程序。v3。
得到签署URL它看起来有点像这个
const s3Params = {
Bucket : bucketName,
Key : fileName,
ContentType:fileType,
// Metadata:{'Content-Disposition':'attachment'}
// ContentDisposition:'attachment'
};
try {
const command = new PutObjectCommand(s3Params);
const url = await getSignedUrl(s3v3,command,{expiresIn:60});
return url;
} catch (e) {
console.log('************** there was an error signing th url');
console.log(e);
throw e;
}
};
这是工作完全正常的,但后来因为我读了一些文件我看到了,我应当能够设置头ContentDisposition. 在 这个文件 ,它说,所输入的PutObjectCommand延伸从 PutObjectRequest
后者有一个可选择的参数所谓 ContentDisposition
因为我想设置为附件,请允许我提示的"下载"窗口对于我的用户。 然而,当我使用signedURL上,但添加 ContentDisposition:'attachment'
领域,我获得一个禁止的错误。
没有人知道,如果我丢失任何东西在这里? 这不是一个实际的选择或者是否需要修改么东西在我的权限的S3为了这个?