subhomoy Posted January 10, 2013 Share Posted January 10, 2013 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... Quote Link to comment https://forums.phpfreaks.com/topic/272920-profile-picture/ Share on other sites More sharing options...
Jessica Posted January 10, 2013 Share Posted January 10, 2013 Don't store the image in the DB. Either store the name of the image, or rename the image to something like their username or user id. Quote Link to comment https://forums.phpfreaks.com/topic/272920-profile-picture/#findComment-1404550 Share on other sites More sharing options...
subhomoy Posted January 10, 2013 Author Share Posted January 10, 2013 Don't store the image in the DB. Either store the name of the image, or rename the image to something like their username or user id. But how will i show the image to their user profile.... Can u plz help me... Quote Link to comment https://forums.phpfreaks.com/topic/272920-profile-picture/#findComment-1404552 Share on other sites More sharing options...
Jessica Posted January 10, 2013 Share Posted January 10, 2013 Use some logic. Quote Link to comment https://forums.phpfreaks.com/topic/272920-profile-picture/#findComment-1404553 Share on other sites More sharing options...
subhomoy Posted January 10, 2013 Author Share Posted January 10, 2013 Thansk for the info.... 1st let me try.... and then I will post the prob... Quote Link to comment https://forums.phpfreaks.com/topic/272920-profile-picture/#findComment-1404554 Share on other sites More sharing options...
Ninjakreborn Posted January 10, 2013 Share Posted January 10, 2013 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 Quote Link to comment https://forums.phpfreaks.com/topic/272920-profile-picture/#findComment-1404703 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.