Jump to content

Profile Picture


subhomoy

Recommended Posts

Hiii i'm trying to create a login page but i want to add some featues i.e they can upload their profile photo. I know the upload form but i cant think how it will work... How the database will show coreect image for the correct user??? Will I have to store it in the database with users id?? But as far as i know We can store any multimedia in the database, only the links can be recorded in the database...

 

Any help would be grately appreciated..

 

Thanks in advance...

Link to comment
Share on other sites

I can give you a basic breakdown of how it works, or how it should work.

 

You would need a form that supported file uploads. First off, you would need to add the correct Enctype, as described here: http://www.w3schools.com/tags/att_form_enctype.asp

For the form to be able to support files. You would also need a file input type as well, for them to be able to select/attach a file.

 

On submittal of the form you need to take the file, save it somewhere on the server (in a folder made for uploads, or something similar) and then save the NAME of the file into the database. Then later on, when you get the file name from the database, you can use that to create a path to the file an do whatever with it. In this situation, use it in an image tag in order to display the image they uploaded, or something similar.

 

To go into further detail, read this tutorial and work through it: http://www.htmlgoodies.com/beyond/php/article.php/3877766/Web-Developer-How-To-Upload-Images-Using-PHP.htm

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.