When I worked on laravel local development server php artisan storage:link
works fine for me. But when I transfer my site to production server then I saw my public storage link was a folder. Then I delete that tried to create a link. I got an error because my app was in the root folder and tried to solve this problem.
Create a symbolic link By default, public disks use local drivers and store these files under storage/app/public . To access them via the web, you need to create a symbolic link from public/storage to storage/app/public . Next, use the command below in order to create the symbolic link.
In your terminal, navigate to your Laravel project folder. Now create the folder /images in your /storage/app/public folder which gives you /storage/app/public/images. Copy a test image named logo. png into the /storage/app/public/images folder.
Steps: cd to your <project_root>/public directory and run rmdir storage - it will remove the link. cd back to project root directory and run php artisan storage:link to link again.
Laravel Symbolic link is used to link storage/app/public directory with the public directory. The easiest way to understand Symbolic link is to think a folder shortcut which we usually create in Windows.
I solved this problem by another command for creating a symbolic link by terminal/cmd/shh:
ln -s /path/to/laravel/storage/app/public /path/to/public/storage
I solved this also Using laravel web route routes/web.php
Route::get('/foo', function () { Artisan::call('storage:link'); });
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With