barryvdh / elfinder-flysystem-driver

elFinder driver for Flysystem
183 stars 41 forks source link

Cant access url "Digital Ocean Spaces" #78

Open vanthao03596 opened 4 years ago

vanthao03596 commented 4 years ago

I cant access my image after upload to Digital Ocean Spaces. I also try set 'visibility' => 'public' filesystem.php. here is my configuration elfinder.php `<?php

return array(

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

/*
|--------------------------------------------------------------------------
| 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' => [
    'public' => [
        'URL' => env('APP_URL') . '/upload',
        'path' => 'upload'
    ],
    'spaces' => [
        'URL' => 'https://'.env('DO_SPACES_BUCKET').'.sgp1.digitaloceanspaces.com',
        'acl' => 'public-read',
    ]
],

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

'route' => [
    'prefix' => 'elfinder',
    'middleware' => array('web', 'auth'), //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' => [
],

/*
|--------------------------------------------------------------------------
| 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' => array(),

/*
|--------------------------------------------------------------------------
| Root Options
|--------------------------------------------------------------------------
|
| These options are merged, together with every root by default.
| See https://github.com/Studio-42/elFinder/wiki/Connector-configuration-options-2.1#root-options
|
*/
'root_options' => array(

),

); `

Here is filesystems.php `<?php

return [

/*
|--------------------------------------------------------------------------
| Default Filesystem Disk
|--------------------------------------------------------------------------
|
| Here you may specify the default filesystem disk that should be used
| by the framework. The "local" disk, as well as a variety of cloud
| based disks are available to your application. Just store away!
|
*/

'default' => env('FILESYSTEM_DRIVER', 'local'),

/*
|--------------------------------------------------------------------------
| Default Cloud Filesystem Disk
|--------------------------------------------------------------------------
|
| Many applications store files both locally and in the cloud. For this
| reason, you may specify a default "cloud" driver here. This driver
| will be bound as the Cloud disk implementation in the container.
|
*/

'cloud' => env('FILESYSTEM_CLOUD', 's3'),

/*
|--------------------------------------------------------------------------
| Filesystem Disks
|--------------------------------------------------------------------------
|
| Here you may configure as many filesystem "disks" as you wish, and you
| may even configure multiple disks of the same driver. Defaults have
| been setup for each driver as an example of the required options.
|
| Supported Drivers: "local", "ftp", "sftp", "s3"
|
*/

'disks' => [

    'local' => [
        'driver' => 'local',
        'root' => storage_path('app'),
    ],

    'public' => [
        'driver' => 'local',
        'root' => storage_path('app/public'),
        'url' => env('APP_URL').'/storage',
        'visibility' => 'public',
    ],

    'upload' => [
        'driver' => 'local',
        'root' => storage_path('app/public/upload'),
        'url' => env('APP_URL').'/storage',
        'visibility' => 'public',
    ],

    's3' => [
        'driver' => 's3',
        'key' => env('AWS_ACCESS_KEY_ID'),
        'secret' => env('AWS_SECRET_ACCESS_KEY'),
        'region' => env('AWS_DEFAULT_REGION'),
        'bucket' => env('AWS_BUCKET'),
        'url' => env('AWS_URL'),
    ],

    'spaces' => [
        'driver' => 's3',
        'key' => env('DO_SPACES_KEY'),
        'secret' => env('DO_SPACES_SECRET'),
        'region' => env('DO_SPACES_REGION'),
        'bucket' => env('DO_SPACES_BUCKET'),
        'endpoint' => env('DO_SPACES_ENDPOINT'),
    ],

],

]; `