2

I'm running a Laravel app with a code like this in one of my controller functions:

$s3 = Storage::disk('s3');
$s3->put( $request->file('file')->getClientOriginalName(), file_get_contents($request->file('file')) );

I believe Laravel utilizes Flysystem behind the scenes to connect to s3. When trying to execute this piece of code I get an error like this:enter image description here

The Laravel docs isn't giving me much insight into how/why this problem is occurring. Any idea what is going on here?


EDIT: After going through a few other stackoverlflow threads:

it seems as if the issue may be more related to my server's DNS? I'm on a ubuntu 14.04 on a Linode instance. I use Nginx as my webserver.

Community
  • 1
  • 1
Zaki Aziz
  • 3,592
  • 11
  • 43
  • 61
  • give me the output of : $request->file('file')->getClientOriginalName(), file_get_contents($request->file('file')) – Yehia Awad Jan 25 '16 at 03:50
  • `$request->file('file')->getClientOriginalName()` returns `image.png` and `file_get_contents($request->file('file'))` return the long output you see above on line 13 in the error screenshot – Zaki Aziz Jan 25 '16 at 05:10
  • try this: File::get((string)$request->file('file')) and add "use File"; at the top.. instead of this: file_get_contents($request->file('file')) – Amir Bar Jan 25 '16 at 08:52
  • See it http://stackoverflow.com/a/22287443/3631503 – mcklayin Jan 25 '16 at 16:16
  • My SELinux is disabled – Zaki Aziz Jan 25 '16 at 18:58

2 Answers2

3

Your S3 configuration seems to be wrong, as the host it tries to use s3.us-standard.amazonaws.com cannot be resolved on my machine either. You should verify that you have configured the right bucket + region.

ZeissS
  • 11,867
  • 4
  • 35
  • 50
1

Check that your S3 API endpoints are correct.

To eliminate permission (role/credential) and related setup errors, try doing a put-object using the AWS CLI s3api, from that server.

aws s3api put-object --bucket example-bucket --key dir-1/big-video-file.mp4 --body e:\media\videos\f-sharp-3-data-services.mp4
Rodrigo Murillo
  • 13,080
  • 2
  • 29
  • 50
  • This answer has helped me find the issue. Even though the s3 docs state that `Amazon S3 renamed the US Standard region to the US East (N. Virginia) region to be consistent with AWS regional naming conventions. There is no change to the endpoint and you do not need to make any changes to your application.` I was not able to connect with the `us-standard` region. I had to change the name to `us-east-1` – Zaki Aziz Jan 28 '16 at 20:52