Changes the content type for an existing 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. |
|
|
Required |
The content-type to apply to the object. |
|
|
Optional |
An associative array of parameters that can have the following keys:
|
Returns
Type |
Description |
---|---|
A |
Examples
Change the content type of an object.
// Instantiate the class $s3 = new AmazonS3(); $bucket = 'my-bucket' . strtolower($s3->key); $cct = $s3->change_content_type($bucket, 'test1.txt', 'text/plain'); sleep(5); $metadata = $s3->get_object_metadata($bucket, 'test1.txt'); // Success? var_dump($cct->isOK()); var_dump($metadata['ContentType']);Result:
bool(true) string(10) "text/plain"
Source
Method defined in services/s3.class.php | Toggle source view (29 lines) | View on GitHub