So, funny thing with v3 that no one documented anywhere is that you need to have the 'credentials' => [ 'key', 'secret'] config set when creating the S3Client. I've been spending hours debugging getting FlySystem to work with Google Cloud Storage but running into a lot of road blocks.
Jul 23, 2015
6
Level 1
L5.1 Upload file to AWS S3 using filesystem AWS PERMISSIONS PROBLEM I think
It seems awesome that Laravel made it so much easier to use alternate storage systems. Following this guide: http://laravel.com/docs/5.1/filesystem#introduction
I was able to upload a file locally (storage->app) by doing:
public function store() {
\Storage::disk('local')->put('file.txt', 'Contents');
return "Done";
}
I added this to my composer.json and updated:
"league/flysystem-aws-s3-v3": "~1.0"
Next i updated my config->filesystem file:
's3' => [
'driver' => 's3',
'key' => env('AWS_KEY'),
'secret' => env('AWS_SECRET'),
'region' => env('AWS_LOCATION'),
'bucket' => 'bucket_name',
],
Changed my controller method to:
public function store() {
// \Storage::disk('local')->put('file.txt', 'Contents');
\Storage::disk('s3')->put('file.txt', 'Contents');
return "Done";
}
This is the error i get:
S3Exception in WrappedHttpHandler.php line 152:
Error executing "HeadObject" on "https://s3.amazonaws.com/testrbucket/file.txt"; AWS HTTP error: Client error: 403 (client): 403 Forbidden (Request-ID: BF4C61A3B6218425)
Anyone got something similar?
Please or to participate in this conversation.