我正在尝试从Amazon S3的图片的URL。
当我运行下面的脚本,我得到一个错误:
Missing required Key in params
这是我到目前为止有:
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script src="https://sdk.amazonaws.com/js/aws-sdk-2.0.16.min.js"></script>
<script type="text/javascript">
function test1(){
AWS.config.update({
accessKeyId: 'accesskey',
secretAccessKey: 'secretKey'
});
AWS.config.region = 'us-west-2';
var myAWS = new AWS.S3();
myAWS.getObject(
{ Bucket: 'productissues', key: 'carlos.jpg' },
function (error, data) {
if (error != null) {
alert("Failed to retrieve an object: " + error);
} else {
alert("Loaded " + data.ContentLength + " bytes");
// do something with data.body
}
});
}
</script>
</head>
<body>
<button type="button" onclick="test1();" >Click me!</button>
</body>
</html>