jeudi 25 juin 2015

How to download an Object from AWS S3 Bucket with PHP?

I know how do upload an object to Aws S3 Bucket like this:

try {
    $oClientAws->putObject(array(
        'Bucket' => 'bucket_test',
        'Key'    => 'fileName.jpg',
        'Body'   => fopen('path/to/file/fileName.jpg', 'r'),
        'ACL'    => 'public-read',
    ));            
} 
catch (Aws\Exception\S3Exception $e) {}

But i don't know how to download an object i can use $oClientAws->getObject(parms...) and change the content type of the header but this just show my file on the browser, but don't download the file.

tks!




Aucun commentaire:

Enregistrer un commentaire