AWS S3 da InvalidDigest [El contenido-MD5 que especificó no era válido] Error mientras se usa copy_object()

I've started working with AWS S3 service, and getting success in creating bucket as well as uploading object into any bucket. But when i have tried to Copy object from one bucket to other bucket, i have getting this exception in the response.

de Recursos i have used is : http://docs.aws.amazon.com/AWSSDKforPHP/latest/index.html#m=AmazonS3/copy_object

Excepción I got is:

[body] => CFSimpleXML Object
    (
        [Code] => InvalidDigest
        [Message] => The Content-MD5 you specified was invalid
    )

[status] => 400

Muestra Code i've used is:

    $Connection = new AmazonS3(array(
    'key' => AWS_KEY,
    'secret' => AWS_SECRET_KEY
        ));
     $Connection->set_hostname($HOST);
     $Connection->allow_hostname_override(false);
     $Connection->enable_path_style();

     $res = $Connection->copy_object(
        array('bucket' => $bucket, 'filename' => ("boxdata/asset4053/images/yesteryear.png")), 
        array('bucket' => $bucket, 'filename' => 'test123.png'), 
        array('acl' => AmazonS3::ACL_PUBLIC,
            'storage' => AmazonS3::STORAGE_STANDARD,
            'metadataDirective' => 'COPY')
);

¡Muchas gracias!

preguntado el 12 de junio de 14 a las 10:06

Any reason why you are not using the latest AWS SDK para PHP? The version you are using hasn't really been updated in well over a year. -

Thanks for your reply @JeremyLindblom, But problem is i am using third party tool acorn.nibbler.io. and they prefer docs.aws.amazon.com/AWSSDKforPHP/latest/index.html#m=AmazonS3/… -

1 Respuestas

This is an old question but I ran into the same problem and found a solution. In the list of options you send to copy_object add NoContentMD5 => true.

 $res = $Connection->copy_object(
    array('bucket' => $bucket, 'filename' => 'test123.png'), 
    array('bucket' => $bucket, 'filename' => 'test456.png'), 
    array('NoContentMD5' => true)
 );

Respondido 27 Oct 15, 17:10

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.