I'm currently using the following code:
include 'lib/sdk.class.php';
$s3 = new AmazonS3();
$bucket = 'mybucket'.strtolower($s3->key);
$key = 'myfile.txt';
$response = $s3->if_object_exists($bucket,$key);
But $response
keeps coming back false when the file does exist, is there something I'm missing?
After messing around with the code here and there, I had looked at some of my previous S3 calls from other sites I've created and compared how those were done. I've notice on my previous codes I didn't use the following:
$bucket = 'mybucket'.strtolower($s3->key);
Instead I used:
$bucket = 'mybucket';
The final code looked like this:
include 'lib/sdk.class.php';
$s3 = new AmazonS3();
$bucket = 'mybucket';
$key = 'myfile.txt';
$response = $s3->if_object_exists($bucket,$key);
This ended up working. However, I have no clue why this works over the example provided by amazon.