Laravel 5.4 Storage link
First of all in the .env file create a variable named FILESYSTEM_DRIVER and set it to public
like this
FILESYSTEM_DRIVER=public
and then create symbolic link by run
php artisan storage:link
after that just use asset()
<img src="{{ asset('storage/'.$cv->photo) }}" alt="...">
It'll work fine 😊
2
Go to public directory:
cd public
Run this to remove the Storage folder:
rm -r storage
Go back to project root:
cd ..
Then run:
php artisan storage:link
The public
disk is intended for files that are going to be publicly accessible. By default, the public
disk uses the local driver and stores these files in storage/app/public
. To make them accessible from the web, you should create a symbolic link from public/storage
to storage/app/public
. Laravel doc
Create Symbolic link in Linux
ln -s source_file myfile
3
solved it with just a simple modification on the filesystems config/file systems from :
'local' => [
'driver' => 'local',
'root' => storage_path('app'),
]
to :
'local' => [
'driver' => 'local',
'root' => storage_path('app/public'),
]
if you're unable to create symblink on LAMP via running
php artisan storage:link
then run
ln -s public_html/storage/app/public public_html/public/storage
if your not in public_html or at root folder then run
ln -s /application/xyhpnqyw/public_html/storage/app/public /application/xyhpnqyw/public_html/public/storage
target='/application/xyhpnqyw/public_html/storage/app/public'
shortcut='/application/xyhpnqyw/public_html/public/storage'