Laravel - File Storage - File Urls
You may use the url
method to get the URL for a given file. If you are using the local
driver, this will typically just prepend /storage
to the given path and return a relative URL to the file. If you are using the s3
driver, the fully qualified remote URL will be returned:
use Illuminate\Support\Facades\Storage;
$url = Storage::url('file.jpg');
When using the local
driver, all files that should be publicly accessible should be placed in the storage/app/public
directory. Furthermore, you should create a symbolic link at public/storage
which points to the storage/app/public
directory.
When using thelocal
driver, the return value ofurl
is not URL encoded. For this reason, we recommend always storing your files using names that will create valid URLs.