0
votes

I am using file system storage to upload files. When I change filesystem_driver from local to public I get this error :

vendor/league/flysystem/src/Adapter/Local.php:367

public function setVisibility($path, $visibility){
    $location = $this->applyPathPrefix($path);
    $type = is_dir($location) ? 'dir' : 'file';
    $success = chmod($location, $this->permissionMap[$type][$visibility]); // line 367

    if ($success === false) {
        return false;
    }

Disk settings

'disks' => [

    'local' => [
        'driver' => 'local',
        'root' => storage_path('app'),
        'permissions' => [
            'file' => [
                'public' => 0664,
                'private' => 0600,
            ],
            'dir' => [
                'public' => 0775,
                'private' => 0700,
            ],
        ],
    ],

    'public' => [
        'driver' => 'local',
        'root' => storage_path('app/public'),
        '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'),
    ],

],

I tried to change the file permissions according to this post, but it doesn't work. If I change the filesystem_driver to local I cannot display the pictures in front end. This is a local development environment WSL Ubuntu 18.

What do I do wrong here?

1
storage directory has wrong permissions it should be apache or nginx as owner of the directory via sudo chown www-data:www-data storageBader
@Bader I did that but it doesn't help. files being uploaded but this error comes up regardless after posting the form.Erdem Ece
did you linked your public folder with php artisan storage:linkBader
@bader it turns out windows subsystem linux does not support cmod if your webfiles are outside of linux. I moved files into linux file system and it's working now. only problem I have is that I cannot display the pictures now.Erdem Ece

1 Answers

0
votes

problem was cmod is not support under ntfs file system https://github.com/Microsoft/WSL/issues/81