Gets whether or not the specified Amazon S3 object exists in the specified bucket.
Access
public
Parameters
Parameter |
Type |
Required |
Description |
---|---|---|---|
|
Required |
The name of the bucket to use. |
|
|
Required |
The file name for the object. |
Returns
Type |
Description |
---|---|
A value of |
Examples
Check to see if an object exists.
Note: This does not check whether you can read the object — only if it exists.
// Instantiate the class $s3 = new AmazonS3(); $bucket = 'my-bucket' . strtolower($s3->key); $response = $s3->if_object_exists($bucket, 'test1.txt'); // Success? (Boolean, not a CFResponse object) var_dump($response);Result:
bool(true)
Related Methods
Source
Method defined in services/s3.class.php | Toggle source view (16 lines) | View on GitHub