DeweyOx
DeweyOx

Reputation: 719

How to define ContentMD5 parameter for AWS S3 PHP SDK 2 method call

Maybe I'm missing something, but I've been looking everywhere and can't find a decent explanation for the ContentMD5 required parameter in the PHP SDK 2 for deleteObjects (http://docs.aws.amazon.com/aws-sdk-php-2/latest/class-Aws.S3.S3Client.html#_deleteObjects)

Docs say it "defaults to true", however that makes me assume it's a boolean value - however, I'm always getting a 4** response when executing the command with a Boolean - I think it's something else.

It's a simple call:

$s3 = S3Client::factory(array(
'key' => S3_KEY,
'secret' => S3_SECRET
));

$response = $s3->deleteObjects(array(
'Bucket'    => $bucket,
'Objects'   => $array_of_keys,
'ContentMD5' => ???????????
));

Any help on how I define the ContentMD5 param would be super helpful.

Thanks!

Upvotes: 0

Views: 384

Answers (1)

dcro
dcro

Reputation: 13649

The correct usage for the deleteObjects method in the AWS PHP SDK v2 is this one:

$s3->deleteObjects(array(
    'Bucket' => 'your-bucket-name',
    'Objects' => array(
        array('Key'=>'first-file.ext'),
        array('Key'=>'second-file.ext')
    )
);

You do not need to define the ContentMD5 parameter.

Upvotes: 2

Related Questions