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

242

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

Alaz

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 ☕️

Welcome to PostSrc V3

PostSrc Dark Logo

You have to login to favorite this