Sets the access control list (ACL) settings for the specified Amazon S3 object.
Access
public
Parameters
Parameter |
Type |
Required |
Description |
---|---|---|---|
|
Required |
The name of the bucket to use. |
|
|
Required |
The file name for the object. |
|
|
Optional |
The ACL settings for the specified object. Accepts any of the following constants: [Allowed values: |
|
|
Optional |
An associative array of parameters that can have the following keys:
|
Returns
Type |
Description |
---|---|
A |
Examples
Set a canned ACL setting on an object.
// Instantiate the class $s3 = new AmazonS3(); $bucket = 'my-bucket' . strtolower($s3->key); $response = $s3->set_object_acl($bucket, 'test1.txt', AmazonS3::ACL_PUBLIC); // Success? var_dump($response->isOK());Result:
bool(true)
Set a custom ACL setting on an object.
// Instantiate the class $s3 = new AmazonS3(); $bucket = 'my-bucket' . strtolower($s3->key); $response = $s3->set_object_acl($bucket, 'test1.txt', array( array( 'id' => AmazonS3::USERS_AUTH, 'permission' => AmazonS3::GRANT_READ ), // Authenticated users, READ array( 'id' => CFCredentials::get()->canonical_id, 'permission' => AmazonS3::GRANT_FULL_CONTROL ) // Self, FULL_CONTROL )); // Success? var_dump($response->isOK());Result:
bool(true)
See Also
Source
Method defined in services/s3.class.php | Toggle source view (42 lines) | View on GitHub