DEV Community

webfuelcode
webfuelcode

Posted on

2 1

Laravel filesystems storage path

I personally stuck on the point where I created projects and forgot to change the path from storage to public. Actually, I wanted to store the file(images) in the image folder that was created in the root.

This is what we see in the filesystems.php file

'disks' => [

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

        'public' => [
            'driver' => 'local',
            'root' => storage_path('img'),
            'url' => env('APP_URL').'/img',
            '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'),
        ],

    ],
Enter fullscreen mode Exit fullscreen mode

Making your own way to stare the images. You can change the path by ...

'public' => [
            'driver' => 'local',
            'root' => storage_path('img'),
            'url' => env('APP_URL').'/img',
            'visibility' => 'public',
        ],
Enter fullscreen mode Exit fullscreen mode

In the 'root' => storage_path('img), You can change it like these

base_path();    // '/var/www/mysite'
app_path();     // '/var/www/mysite/app'
storage_path(); // '/var/www/mysite/storage'
Enter fullscreen mode Exit fullscreen mode

This post is just a help and it is available on StackOver: https://stackoverflow.com/questions/14631436/laravel-base-path

Image of Stellar post

How a Hackathon Win Led to My Startup Getting Funded

In this episode, you'll see:

  • The hackathon wins that sparked the journey.
  • The moment José and Joseph decided to go all-in.
  • Building a working prototype on Stellar.
  • Using the PassKeys feature of Soroban.
  • Getting funded via the Stellar Community Fund.

Watch the video

Top comments (0)

👋 Kindness is contagious

Explore this insightful post in the vibrant DEV Community. Developers from all walks of life are invited to contribute and elevate our shared know-how.

A simple "thank you" could lift spirits—leave your kudos in the comments!

On DEV, passing on wisdom paves our way and unites us. Enjoyed this piece? A brief note of thanks to the writer goes a long way.

Okay