我正在尝试使用 dojo.io.send 将文件上传到我的亚马逊帐户。但是,它没有这样做。
这是我在运行萤火虫时看到的错误。
<Error>
<Code>InvalidArgument</Code>
<Message>Bucket POST must contain a field named 'key'. If it is specified,
please check the order of the fields.</Message>
<ArgumentValue></ArgumentValue>
<ArgumentName>key</ArgumentName>
我找到了原因,显然“Key”字段位于“File”字段的下方,因为它忽略了下面的字段并抛出错误。
为了纠正这个问题,我需要 dojo.io.send() 以下列方式发送参数列表:-
key uploads/${filename}
AWSAccessKeyId
policy
signature
Content-Type plain/text
file
我通过玩下面的代码来试试运气,但它总是将文件字段放在顶部。
如果有人可以帮助我更改顺序,我将不胜感激。
代码片段:-
var jsonpArgs =
{
url: "https://s3.amazonaws.com/<Bucketname>",
form : dojo.byId("Myform"),
//MyForm has an attribute
//as file which takes the file name from the user to upload.
handleAs: "json",
content:
{
"key":"*******",
"AWSAccessKeyId":"****",
"policy" :"***********",
"signature":"*******",
"Content-Type":"plain/text"
},
error: function(error)
{
},
};
dojo.io.iframe.send(jsonpArgs);
},
赞赏,