0

I am trying to delete the files on Amazon s3 bucket using simpledb. But for some reason it does not delete the file and says that it has deleted it.

I am using S3 classdeleteObject method to delete the file. Below is the sample code :

$bucketName = "bucket";
$s3 = new S3($awsAccessKey, $awsSecretKey);
if ($s3->deleteObject($bucketName, $url))
{
    echo "deleted url";
}
else
{
    echo "cannot delete";
}

After execution the script echoes "deleted url" which should happen when deletion is successfully completed. But when I open the URL again, the file is still there and has not been deleted.

Please help.

Thanks a lot.

Sameeksha Kumari
  • 1,158
  • 2
  • 16
  • 21

2 Answers2

1

You are using the unofficial S3.php class. The GitHub repo with documentation is here: https://github.com/tpyo/amazon-s3-php-class

This code is not provided by AWS, and should not be confused with either AWS SDK for PHP 1.x or AWS SDK for PHP 2.x.

Ryan Parman
  • 6,855
  • 1
  • 29
  • 43
0

Make sure you are giving the right file name for the object in parameter. I guess, you are storing file in Amazon S3 and you are keeping the URL of that file into Amazon SimpleDB. So you need to provide a valid file name in parameter instead of URL.

Ashish Pancholi
  • 4,569
  • 13
  • 50
  • 88