Do you want to fix the storage link not working issue in Laravel?
In this article, we will show How to fix the Storage link that already exists in Laravel, So you can easily apply it to your Laravel 5, Laravel 6, Laravel 7, Laravel 8, and Laravel 9 application.
This step-by-step tutorial helps you learn the most common issue of how to fix the storage link that already exists but we are getting a 404 error when trying to get a file from the public folder Error.
Why do you get the error Laravel cannot access the storage folder
Laravel provides a powerful filesystem abstraction Filesystem PHP package by Frank de Jonge.
The public disk included in your application’s filesystems configuration file is intended for files that are going to be publicly accessible. By default, the public disk uses the local driver and stores its files in storage/app/public.
To make these files accessible from the web, you should create a symbolic link from public/storage to storage/app/public. Utilizing this folder convention will keep your publicly accessible files in one directory that can be easily shared across deployments when using zero downtime deployment systems like Envoyer.
Fix the storage link not working issue in Laravel
To understating the issue of the Storage link that already exists in Laravel, we created a list blade file, whenever you save our file to a storage folder we need to link the public storage folder to get an image or file in our application, but if you already link the storage folder you need to follow this simple step.
Go to your project’s public folder, and delete the storage folder, if it exists.
Then run this command line:
php artisan storage:link
That’s it, now you can access your all files and images stored in a storage folder in your Laravel application.
I hope that this article helped you learn how to fix Laravel cannot access the storage folder. You may also want to check out our guide on How to Create a factory in the Laravel application.
Also Read : Indian State, City SQL Database in Laravel.