mardi 29 novembre 2016

Upload file in S3 using Laravel 5.3

Installation Process

I followed this tutorial to install aws Package in Laravel 5.3

My Code is below

$s3 = \App::make('aws')->createClient('s3');

$s3->putObject(array(
    'Bucket'     => 'Bucket_Name',
    'Key'        => 'AWS_ACCESS_KEY_ID',
    'SourceFile' => 'http://domainname/sample.txt',
));

I am trying a txt file with around 50 bytes contents and got below error.

A sha256 checksum could not be calculated for the provided upload body, because it was not seekable. To prevent this error you can either 1) include the ContentMD5 or ContentSHA256 parameters with your request, 2) use a seekable stream for the body, or 3) wrap the non-seekable stream in a GuzzleHttp\Psr7\CachingStream object. You should be careful though and remember that the CachingStream utilizes PHP temp streams. This means that the stream will be temporarily stored on the local disk.

Am I missing something?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire