这是我使用 yui uploader 的一部分:
function upload() {
if (fileID != null) {
uploader.upload(fileID, "http://url",
'POST',
{ AWSAccessKeyId: "keyhere",
acl: "public-read",
key: "queue/${filename}",
policy: "somestring",
Content-Type: "",
success_action_redirect: "http://urlhere",
signature: "sigstring"
},
'file');
fileID = null;
}
}
“Content-Type”导致语法错误。我可以看到问题所在。但是我发布到的亚马逊 s3 存储桶需要这个变量名称。 所以我无法选择用下划线替换减号或使用 CamelCase 概念。
如何提交“Content-Type”作为变量名称?
最佳答案
将 key 放在引号中:
"Content-Type": "",
关于javascript - 语法错误: unexpected token in Javascript/posting data to amazon s3,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10781598/