Support the ongoing development of Laravel.io →
posted 3 years ago
Last updated 1 year ago.
0

please create a symlink first

php artisan storage:link

then try this code to get

$file = public_path('storage/profile-photos/t5Kxo6R7IjspwImQNcwayPU4jG6fmYoS4r5kupIK.png');

Hopefully it will work. it will solve the problem

OUT TOPIC: (but important) How to store image perfectly (Try this code) first create symlink (if you already do then please skip)

php artisan storage:link

from form pass image field as (whatever you want) name = image

to controller write code

$fileOriginalName = $request->file('image')->getClientOriginalExtension();
$image = time() . $fileOriginalName;
$request->image->storeAs('image', $image, 'public');

from view show (please modify $data->value to your variable and coloumn name)

<img src="{{asset('/storage/image/'.$data->value)}}" >
Last updated 3 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.