Updates an Amazon S3 object with new headers or other metadata. To replace the content of the
specified Amazon S3 object, call create_object()
with the same bucket and file name parameters.
Access
public
Parameters
Parameter |
Type |
Required |
Description |
---|---|---|---|
|
Required |
The name of the bucket that contains the source file. |
|
|
Required |
The source file name that you want to update. |
|
|
Optional |
An associative array of parameters that can have the following keys:
|
Returns
Type |
Description |
---|---|
A |
Examples
Update an object.
// Instantiate the class $s3 = new AmazonS3(); $bucket = 'my-bucket' . strtolower($s3->key); $headers = $s3->get_object_headers($bucket, 'test1.txt'); var_dump($headers->header['content-type']); $response = $s3->update_object($bucket, 'test1.txt', array( 'acl' => AmazonS3::ACL_PUBLIC, 'headers' => array( 'Content-Encoding' => 'UTF-8' ), 'meta' => array( 'Cache-Control' => 'Public', 'Max-Age' => '604800', ), )); var_dump($response->isOK()); sleep(2); $headers = $s3->get_object_headers($bucket, 'test1.txt'); var_dump($headers->header['content-type']);Result:
string(10) "text/plain" bool(true) string(10) "text/plain"
Related Methods
See Also
Source
Method defined in services/s3.class.php | Toggle source view (35 lines) | View on GitHub