Lars-Janssen's avatar

Laravel acces file upload

Hi,

I've successfully uploaded an image like this:

Storage::put($path,$request->file($name));

But how could I acces this right now? The file is in storage/app/employees/3/profile.

When I go to .dev/storage/app/employees/3/profile/image.png the route is not found.

0 likes
3 replies
ohffs's avatar

Depending what you mean by 'access', you could do things like :

YourController:
public function getImage($id)
{
  $image = Image::findOrFail($id);
  return response()->file($image->path);
}

YourView:
<img src="{{{ action('YourController@getImage', $image->id) }}}">

Please or to participate in this conversation.