致命错误:未定义的类常量'ACL_PUBLIC_READ'

时间:2013-05-06 13:02:43

标签: file-upload amazon-web-services amazon-s3 amazon

我下载了AWS SDK并将其存储在此文件的同一目录中,但是每个简单的脚本都会出现此错误:

"Fatal error: Undefined class constant 'ACL_PUBLIC_READ'"

此脚本用于在s3上传一个简单的png图像:

require 'aws.phar';
$bucket='example';

use Aws\S3\S3Client;
use Aws\Common\Enum\Region;

$client = S3Client::factory(array(
    'key'    => 'mykey',
    'secret' => 'mysecretkey'
));


$client->putObject($_FILES['myfile']['tmp_name'], $bucket , 'file.png', S3Client::ACL_PUBLIC_READ);

我该如何解决?

1 个答案:

答案 0 :(得分:0)

SDK 2.x中不存在该常量。我想你正在寻找这个:

http://docs.aws.amazon.com/aws-sdk-php-2/latest/class-Aws.S3.Enum.CannedAcl.html