我使用下面的代码用JS将文件上传到S3。不知道这里出了什么问题。任何帮助将受到高度赞赏..
request: {
endpoint: "https://photoform.s3.amazonaws.com",
inputName: 'name',
forceMultipart: false,
paramsInBody : true,
filenameParam : 'test',
params: {},
accessKey: "AKIAIM5CBG3WFLLZBTAA"
},
signature: {
//always included
"expiration": "2014-02-04T14:32:31.373Z",
signature : "Bv7MiXh5LM4nQGcK0HVgu27DmQE=",
policy: "eyAiZXhwaXJhdGlvbiI6ICIyMDE0LTAyLTA0VDE0OjMyOjMxLjM3M1oiLCJjb25kaXRpb25zIjogWyB7ImJ1Y2tldCI6ICJwaG90b2Zvcm0iIH0gLHsgImFjbCI6ICJwdWJsaWMtcmVhZCIgfSx7IkNvbnRlbnQtVHlwZSI6ImpwZyJ9LHsic3VjY2Vzc19hY3Rpb25fcmVkaXJlY3QiOiJodHRwczovL2NzMzAuc2FsZXNmb3JjZS5jb20vYXBleC9MaXN0U2xpZGVyVXBsb2FkUGljc1N1Y2Nlc3MifSxbInN0YXJ0cy13aXRoIiwgIiRrZXkiLCAiIl0gXX0=",
"conditions":
[
//always included
{"acl": "public-read"},
//always included
{"bucket": "photoform"},
//not included in IE9 and older or Android 2.3.x and older
{"Content-Type": "jpg"},
//always included
{"key": "AKIAIM5CBG3WFLLZBTAA"},
//always included
{"x-amz-meta-qqfilename": "test.jpg"},
]
},
cors: {
expected: true, //all requests are expected to be cross-domain requests
sendCredentials: false, //if you want cookies to be sent along with the request
allowXdr: true
},
答案 0 :(得分:0)
请仔细阅读文档网站上的文档,其中介绍了如何使用Fine Uploader S3。签名选项不是您创建策略文档的位置。您必须指定Fine Uploader将发送其创建的策略文档的端点,而不是在签名选项中对策略文档和签名进行硬编码。您的服务器应签名并返回签名。
有用的链接: