itsoft3g
itsoft3g

Reputation: 515

Amazon S3 API no bucket error

The following is sample code from Amazon S3 API Documentation.

$s3 = new AmazonS3();
$bucket = 'my-bucket' . strtolower($s3->key);
 
$response = $s3->create_object($bucket, 'prefix with spaces with spaces.txt', array(
    'body' => 'This is my body text.'
));
 
// Success?
var_dump($response->isOK());

This works on live site but on the localhost the latter gives an error saying no bucket found

$s3 = new AmazonS3();
   $bucket = 'my-bucket';
 
  $response = $s3->create_object($bucket, 'prefix with spaces with spaces.txt', array(
    'body' => 'This is my body text.'
));

  // Success?

but removing the . strtolower($s3->key); works

Upvotes: 0

Views: 296

Answers (1)

Tej Kiran
Tej Kiran

Reputation: 2238

Amazon S3 is case sensitive. So for Bucket as well as Object if you changes the Name to Upper or Lower Case, It will give you different result.

Means if Bucket Name has some Capital Laters and your code make changed the it name to lower case then It will returns you Bucket Does No Exist like message.

So make sure that what actually bucket as well as object name exist at Amazon S3.

Upvotes: 3

Related Questions