我正在尝试将文件上传到s3,但出现此错误:
“根据策略无效:策略条件失败:[“ eq”,“ $ success_action_status”,“ 201”]“
FineUploader似乎在POST中将“ success_action_status”传递给S3,这是造成此问题的原因吗?
UI
const uploader = new FineUploaderS3({
options: {
request: {
accessKey: "accessKey",
endpoint: "https://MyBUCKET.s3.amazonaws.com",
customHeaders: {
"Authorization": "",
},
},
signature: {
endpoint: 'home/generatesignature'
},
callbacks: {
onComplete: function (id, name, res, a) {
console.log(res)
console.log(a)
}
},
objectProperties: {
key: function (fileId) {
return "images/"
},
acl: 'public-read',
bucket: 'bucketName',
},
debug: true,
autoUpload: true
}
})
政策
var s3Policy = {
"expiration": getExpiryTime(),
"conditions": [
["starts-with", "$key", "images/"],
{
"bucket": process.env.AWS_S3_BUCKET
},
{
"acl": "public-read"
},
["starts-with", "$Content-Type", contentType],
{ "x-amz-meta-qqfilename": "houna.png" },
{
'success_action_status': '201'
}
]
};