DEV Community

Raju Singh
Raju Singh

Posted on

What is the difference between Local and Public disks with Laravel?

With my team, New laravel guys are always having a simple confusion with laravel storage disks like public or local.

My explanation - Laravel comes with a default disk as local. The local disk is only for storing the local files (not for a public expose).
During the file upload process, You may mention the public disk or change the configuration via the .env file.

For accessing a file URL, always use Storage::url() (The alternate way is the url() function. It will help in the future if we move or change our storage disk eg s3.

Image description

Top comments (0)