Uploading to S3 with Laravel 5.2

Having an issue with the s3 driver for laravel 5.2.

The error i’m getting is this:

Found 1 error while validating the input provided for the HeadObject operation: [Key] must be at least 1 characters long. Value provided is 0 characters long.

I’m using the league flysystem V3 as stated in Laravel docs. When I follow the stack track and start dumping out the vars the ‘Key’ value is always empty but i’ve set it all up in my config file.

Here are the top lines from my stack trace ““


in Validator.php line 38
at Validator->validate('HeadObject', object(StructureShape), array('Bucket' => 'monstervsl', 'Key' => '', '@http' => array())) in Middleware.php line 77
at Middleware::Aws{closure}(object(Command), null) in S3Client.php line 710
at S3Client::AwsS3{closure}(object(Command), null) in S3Client.php line 729
at S3Client::AwsS3{closure}(object(Command), null) in Middleware.php line 53
at Middleware::Aws{closure}(object(Command), null) in SSECMiddleware.php line 59
at SSECMiddleware->__invoke(object(Command)) in AwsClient.php line 208

““ as you can see it’s getting the bucket from my config but not the key it’s empty.

Here is my filesystem.php file ““


's3' => [
'driver' => 's3',
// 'key' => env('S3_KEY'),
// 'secret' => env('S3_SECRET'),
'key' => '8tfnxo8abgn7voaex8rgv', // <- Not my real key
'secret' => 'aw7btx49wXNF7AGWV', // <- not my real secret
'region' => 'eu-west-1',
'bucket' => 'monstervsl',
],

““

Here is my controller, it’s fairly straight forward, I don’t think the put contents stuff is relevant but added it anyway ““

// Write the contents to a new file on disk $view = view(‘iframe’)->with(‘json’, $video->toJson()); $contents = $view->render(); $token = ‘12345’; $filePath = public_path() .’/iframes/’ . $token . ‘.html’; file_put_contents($filePath, $contents);


Storage::disk('s3')->put('/', file_get_contents($filePath));

““

from Newest questions tagged laravel-5 – Stack Overflow http://ift.tt/1Z0gTvn
via IFTTT

Related Posts

Codeigniter : Parse error: syntax error, unexpected ‘const’ (T_CONST), expecting variable (T_VARIABLE) in Laravel project

I’m getting following error: **Parse error: syntax error, unexpected ‘const’ (T_CONST), expecting variable (T_VARIABLE)** Note : It’s working in local but facing issue in production server. private…

Firebase receive notification while tab is active or on focus

What i want is to be able to perform an action when a user receives a notification while the browser is open and tab is active or…

Laravel’s alias loader does not find class

We have a legacy project that we cannot update and we need to make some changes in symfony’s Response.php in vendor. We have solved this by copying…

Laravel 5 – generic document management

I have a system where you can create different types of unique documents. For instance, one document is called Project Identified and this expects certain inputs. Originally,…

Laravel Nova limit the results in indexQuery

I ran intro a situation where I need to limit the results of a resource to only 3 results. To be more specific, based on the logged…

Auditoria en laravel 5.8 [closed]

Cómo puedo automatizar el registro de actividades de un usuario en laravel? Si un usuario ingresa a un app de laravel, debo guardar toda su actividas, a…

Leave a Reply

Your email address will not be published.