Ad

Laravel S3 Storage Disk; Has() Is Returning False

- 1 answer

I am trying to check if a file exists on s3, but I keep getting false back. I feel that I am doing something wrong, because the file does exist on s3.

Here is how I am checking:

$disk   = Storage::disk('s3-avatars');
$exists = $disk->has($md5 . '.png'); // $md5 = 'c81e728d9d4c2f636f067f89cc14862c'

Here is the image: https://s3.amazonaws.com/acessegaming/avatars/c81e728d9d4c2f636f067f89cc14862c.png

Here are my disk settings:

's3-avatars' => [
    'driver' => 's3',
    'key'    => env('AWS_KEY'),
    'secret' => env('AWS_SECRET'),
    'region' => env('AWS_REGION'),
    'bucket' => env('AWS_BUCKET') . '/avatars',
],

Here is the composer.json

"require": {
    "laravel/framework": "5.1.*",
    "league/flysystem-aws-s3-v3" : "~1.0"
},
Ad

Answer

I figured it out!

First I had to download and save this file: http://curl.haxx.se/ca/cacert.pem

Next I needed to update this line in the php.ini file to point to the downloaded file:

curl.cainfo = "c:/config/cacert.pem"
Ad
source: stackoverflow.com
Ad