Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel filesystem outside project

Tags:

php

laravel

Can I use laravel filesystem to save file outside current project? I have this structure: project and cdn.

I've tried custom driver but fails. It wont put any file at cdn folder.

'custom' => [
        'driver' => 'local',
        'root'   => '~/Code/cdn.web/storage',
    ],

$store  = Storage::disk('custom')->put('index.txt', 'contents');

I've followed this answer too Storing files outside the Laravel 5 Root Folder But there is no custom driver.

Is there anyway to make it working?

Thanks

like image 630
ssuhat Avatar asked Dec 07 '25 07:12

ssuhat


1 Answers

Found the answer.

Laravel doesn't support ~ on the path.

I need to put full path to make it working.

'custom' => [
    'driver' => 'local',
    'root'   => '/home/vagrant/Code/cdn.web/storage',
],
like image 136
ssuhat Avatar answered Dec 08 '25 21:12

ssuhat