Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Mego's avatar
Level 1

Upload profile images of users

I have a "portal" with users (about 1000 users), which are stored in "users" table in sql database. I would like to create and image upload engine, where user can upload own profile photo. How can I do that? I need to

  • create a form with mimetype and file input
  • besafe that uploaded file is image in .jpg or .png
  • there will be no resizing and no cropping, just take an image and save it as it is
  • Is possible to save that files to public/ folder?
  • And I need to update a row in "user_profiles" table, to be able to reuse the image everywhere

Is here any really simple way how to do it?

0 likes
1 reply
jlrdw's avatar

The docs actually has a section on uploading:

https://laravel.com/docs/6.x/filesystem#file-uploads

And you can just update the row with image name. And you can retrieve the image with the asset helper:

<img src="{{ asset('assets/upload/imgdogs') . '/' . $row->dogpic }}" alt="" class="image">

Just example, change to your asset url as needed.

Please or to participate in this conversation.