Gets the file size of 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 |
A value of |
Returns
Type |
Description |
---|---|
The number of bytes as an integer, or the friendly format as a string. Returns false if the request failed. |
Examples
Get the size of the object, in bytes.
// Instantiate the class $s3 = new AmazonS3(); $bucket = 'my-bucket' . strtolower($s3->key); $response = $s3->get_object_filesize($bucket, 'video/sample.mp4'); // Success? var_dump($response);
Get the size of the object, measured in the largest reasonable unit.
// Instantiate the class $s3 = new AmazonS3(); $bucket = 'my-bucket' . strtolower($s3->key); $response = $s3->get_object_filesize($bucket, 'video/sample.mp4', true); // Success? var_dump($response);
Source
Method defined in services/s3.class.php | Toggle source view (21 lines) | View on GitHub