显示由fineuploder上传到Amazon S3的图片?

时间:2015-01-06 11:39:34

标签: php amazon-web-services amazon-s3 fine-uploader

我已经按照本教程http://blog.fineuploader.com/2013/08/16/fine-uploader-s3-upload-directly-to-amazon-s3-from-your-browser/使用fineuploader将图像上传到Amazon S3并且上传工作正常。问题是当我想看到我上传到S3的图片时。

我收到错误

[06-Jan-2015 12:30:19 Europe/Berlin] PHP Fatal error:  Uncaught Aws\S3\Exception\AccessDeniedException: AWS Error Code: AccessDenied, Status Code: 403, AWS Request ID: 6F9935EA1BE9F4F5, AWS Error Type: client, AWS Error Message: Access Denied, User-Agent: aws-sdk-php2/2.7.12 Guzzle/3.9.2 curl/7.24.0 PHP/5.3.28 ITR
  thrown in /home/connecti/public_html/aws/Aws/Common/Exception/NamespaceExceptionFactory.php on line 91

当我运行此测试例子时

<?php
require 'aws/aws-autoloader.php';
use Aws\S3\S3Client;

// Instantiate the S3 client with your AWS credentials
$s3 = S3Client::factory(array(

'key' => 'MY_KEY',
'secret' => 'MY_SECRET_KEY',
));


$bucket = 'MY_BUCKET';

// Use the high-level iterators (returns ALL of your objects).
$objects = $s3->getIterator('ListObjects', array('Bucket' => $bucket));

echo "Keys retrieved!\n";
foreach ($objects as $object) {
    echo $object['Key'] . "\n";
}

// Use the plain API (returns ONLY up to 1000 of your objects).
$result = $s3->listObjects(array('Bucket' => $bucket));

echo "Keys retrieved!\n";
foreach ($result['Contents'] as $object) {
    echo $object['Key'] . "\n";
}

?>

我的密钥,密钥和存储桶都是正确的!

与其他例子相同。

我需要做什么?任何人都可以举例说明我如何显示由fineuploader上传的图像,以及我是否必须在亚马逊上进行任何设置(除了我在fineuploader博客上所做的事情)?

1 个答案:

答案 0 :(得分:0)

错误消息表明服务器端密钥没有适当的权限来对相关存储区上的ListObjects或某些相关调用进行调用。您需要重新评估与服务器端密钥关联的IAM用户/组,并确保它具有所有必需的已分配权限。