jeudi 14 février 2019

Cannot store files on Heroku using Laravel

I deployed a simple Laravel (v5.7) app on Heroku with this config:

filesystems.php:

'public' => [
    'driver' => 'local', 
    'root' => storage_path('app/public'), /* app/storage/app/public */
    'url' => env('PUBLIC_STORAGE_URL'), /* http://myApp.herokuapp.com/public/storage */ 
    'visibility' => 'public', 
],

Heroku tree:

app
    Procfile
    app
    database
    storage
        app
            public
    public
        storage

the application works fine on Heroku except I cannot upload files to the public storage folder while it works fine locally, I use:

request()->file($userSelectedFile)->store($userFolderName);

eg. the generated path:

http://myApp.herokuapp.com/public/storage/userFolderName/kwooAGW0CrChzDbUUhOdSXsoLDI99rd1enPd22ZU.png

the file is not created in app/storage/app/public nor in app/public/storage



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire