【发布时间】:2016-02-04 03:27:58
【问题描述】:
我正在使用 AWS EC2 Ubuntu machine 和 AWS PHP SDK V2.8 和 cakephp V2.3。我正在尝试将对象从 AWS S3 下载到我的 AWS 服务器。它工作正常只是一个问题是如何将文件的权限644 设置为777。
这是我的代码。
$saveAs = "/var/www/html/app/webroot/files/image/" . $result[$type][0]['id'] . "/" . $result[$type][0]['attachment'];
$key = "files/image/" . $result[$type][0]['id'] . "/" . $result[$type][0]['attachment'];
$result = $this->Amazon->S3->getObject(array(
'Bucket' => 'mytest.sample',
// 'Key' => 'avtar-auth_test_latest5.png',
'Key' => $key,
'version' => 'latest',
'SaveAs' => $saveAs
));
我也试过
$saveAs = "/var/www/html/app/webroot/files/image/" . $result[$type][0]['id'] . "/" . $result[$type][0]['attachment'];
$key = "files/image/" . $result[$type][0]['id'] . "/" . $result[$type][0]['attachment'];
$result = $this->Amazon->S3->getObject(array(
'Bucket' => 'mytest.sample',
// 'Key' => 'avtar-auth_test_latest5.png',
'Key' => $key,
'version' => 'latest',
'SaveAs' => chmod($saveAs,'0777')
));
【问题讨论】:
标签: php cakephp amazon-web-services amazon-ec2 file-permissions