Change of profile picture of a user with php mysqli?


I need to know how to make a user by default contain a profile picture of an anonymous user, and when you change your profile picture you will see the one you placed and remove the one from the anonymous user.

I'm using PHP, jQuery, AJAX

I just want the idea or if you can and need part of my codes, let me know, xfa.

asked by Abdiel 08.12.2018 в 22:11

1 answer


Create a folder exclusively for user images + the default image.

When a user uploads a new image, assign it a name (eg: username_id_fotoperfil.png), copy it into the images folder and store the path in a database. To put it in place simply use php, get the route with a simple query and ready.

If the query does not return anything, you put the default image.

If you can upload the code you will get more exact answers.

answered by 09.12.2018 в 02:20