FilamentF
Filament17mo ago
Cushty

Spatie media digital ocean spaces, folders

Hi I have got DO spaces working well with filament, the only issues is its only uploading to random folders with numbers, i set a directory but its not working, hope you can help, thanks

SpatieMediaLibraryFileUpload::make('avatar')
                        ->directory('images/' . config('filesystems.disks.do.directory_env'))
                        ->collection('avatars')
                        ->label('Avatar')
                        ->avatar()
                        ->required()
                        ->imageEditor()
                        ->disk('do'),



'do' => [
            'driver' => 's3',
            'key' => env('DO_ACCESS_KEY_ID'),
            'secret' => env('DO_SECRET_ACCESS_KEY'),
            'region' => env('DO_DEFAULT_REGION'),
            'bucket' => env('DO_BUCKET'),
            'url' => env('DO_URL'),
            'endpoint' => env('DO_ENDPOINT'),
            'directory_env' => env('DO_DIRECTORY'),
            'use_path_style_endpoint' => env('DO_USE_PATH_STYLE_ENDPOINT', false),
            'throw' => false,
            'bucket_endpoint' => true,
            'visibility' => 'public',
        ],



DO_DIRECTORY=local
Screenshot_2024-08-21_at_17.11.13.png
Solution
So that would usually be set with:

'root' => env('DO_DIRECTORY', 'local/images'),
Was this page helpful?