barryvdh / laravel-elfinder

elFinder bundle for Laravel
739 stars 171 forks source link

Issue connecting with S3 #228

Open dmarcos89 opened 6 years ago

dmarcos89 commented 6 years ago

Hi, i am having issues configuring my s3 bucket. Not sure where exactly in the config it should go, disks? roots?

<?php

return [

    /*
    |--------------------------------------------------------------------------
    | Upload dir
    |--------------------------------------------------------------------------
    |
    | The dir where to store the images (relative from public)
    |
    */
    'dir' => ['Images'],

    /*
    |--------------------------------------------------------------------------
    | Filesystem disks (Flysytem)
    |--------------------------------------------------------------------------
    |
    | Define an array of Filesystem disks, which use Flysystem.
    | You can set extra options, example:
    |
    | 'my-disk' => [
    |        'URL' => url('to/disk'),
    |        'alias' => 'Local storage',
    |    ]
    */
    'disks' => [
        // 'uploads' => [
        //     'driver' => 'local',
        //     'root' => public_path('uploads'),
        // ],
        // 'public' => [
        //     'driver' => 'local',
        //     'root' => storage_path('app/public'),
        //     'url' => env('APP_URL').'/storage',
        //     'visibility' => 'public',
        // ],
        // 's3' => [
        //     'driver' => 's3',
        //     'key' => env('AWS_KEY'),
        //     'secret' => env('AWS_SECRET'),
        //     'region' => env('AWS_REGION'),
        //     'bucket' => env('AWS_BUCKET'),
        // ],
    ],

    /*
    |--------------------------------------------------------------------------
    | Routes group config
    |--------------------------------------------------------------------------
    |
    | The default group settings for the elFinder routes.
    |
    */

    'route' => [
        'prefix'     => config('backpack.base.route_prefix', 'admin').'/elfinder',
        'middleware' => ['web', 'admin'], //Set to null to disable middleware filter
    ],

    /*
    |--------------------------------------------------------------------------
    | Access filter
    |--------------------------------------------------------------------------
    |
    | Filter callback to check the files
    |
    */

    'access' => 'Barryvdh\Elfinder\Elfinder::checkAccess',

    /*
    |--------------------------------------------------------------------------
    | Roots
    |--------------------------------------------------------------------------
    |
    | By default, the roots file is LocalFileSystem, with the above public dir.
    | If you want custom options, you can set your own roots below.
    |
    */

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

    /*
    |--------------------------------------------------------------------------
    | Options
    |--------------------------------------------------------------------------
    |
    | These options are merged, together with 'roots' and passed to the Connector.
    | See https://github.com/Studio-42/elFinder/wiki/Connector-configuration-options-2.1
    |
    */

    'options' => [],

];

When placing it in roots: Readable volumes not available. When placing it in disks:

Invalid backend response.
Error occurred on the server side.
HTTP error 500

Does my bucket need to have public access? Any help will be much appreciated. Thanks in advance!

buddye commented 6 years ago

I think you need the flysystem aws s3 package: composer require league/flysystem-aws-s3-v3

noogen commented 5 years ago

@dmarcos89 this may help: https://github.com/barryvdh/laravel-elfinder/issues/236#issuecomment-422964351

Ardhendu100 commented 1 year ago

I think you need the flysystem aws s3 package: composer require league/flysystem-aws-s3-v3

I have both packages , still getting error Invalid backend response Readable volumes not available