Home / Snippets / How to Add public_uploads Path in Laravel “filesystems.php” config
How to Add public_uploads Path in Laravel “filesystems.php” config cover

How to Add public_uploads Path in Laravel “filesystems.php” config

216

2 years ago

0 comments

In this short snippet, you will learn how to add a public_uploads path as a "disk" option which will allow you to get the files which is located in the "public" directory.
To set that up all you have to do is define a new configuration like below and it's how it works. 
<?php // filesystems.php

'public_uploads' => [
    'driver' => 'local',
    'root'   => public_path(),
],
And now you can access the disk as follows "disk('public_uploads')".
<?php

\Storage::disk('public_uploads')->url('some-file.png');
The path that it will generate will be something like (let's take example.test as the local domain then the output will be as follows):
https://example.test/some-file.png
Instead of:
https://example.test/storage/some-file.png
notion avatar

Ahmad Aziz

Week-end developer currently experimenting with web, mobile, and all things programming.

Topics:

Frontend

Resource

Average

Average

Support Us

If you like our tutorial, support us by being our Patreon or buy us some coffee ☕️

Post Tutorials

Learn trending tutorials for ReactJs, React Native, VueJS, NextJs, Laravel, Tailwind CSS, and Flutter development.
View Tutorials

Code Components

Collection of Tailwind CSS components for everyone to use. Browse all of the components that's right for your web projects
View Components

Welcome to PostSrc V3

PostSrc Dark Logo

You have to login to favorite this