hi there
I have been learning php and mysql for past about 20days now... i have created a user login and registration system and wondering how to allow a particular user whose unique or primary in the mysql table to upload and retrieve pictures.
Any help would be appreciated.
thanks
how to store images of a unique user in mysql using php
Moderator: General Moderators
-
ryanfern86goa
- Forum Newbie
- Posts: 16
- Joined: Tue Sep 22, 2009 5:26 pm
Re: how to store images of a unique user in mysql using php
If you've already created the login and registration, just check whether the user is logged in before sending the picture uploading/retrieving page. If they aren't, just send a page that says "Sorry, you aren't logged in." This is usually accomplished by saving a token as a session variable when a user successfully logs in. Then you only have to check the session variable for any subsequent controls. Review "session variables" in your PHP instructions.
Re: how to store images of a unique user in mysql using php
I recommend reading through this tutorial from Tizag about uploading files: http://www.tizag.com/phpT/fileupload.php
In addition to uploading the image to your server, you'll also want to store the path to the image in the database, along with all the other data for that user.
In addition to uploading the image to your server, you'll also want to store the path to the image in the database, along with all the other data for that user.
Re: how to store images of a unique user in mysql using php
http://www.php-mysql-tutorial.com/wikis ... abase.aspx
I would check out the link above on how to upload files into a database. That is what I used as go by to wrap my head around the concept and the steps on how to do it. Hope this helps. Cheers!
I would check out the link above on how to upload files into a database. That is what I used as go by to wrap my head around the concept and the steps on how to do it. Hope this helps. Cheers!
-
ryanfern86goa
- Forum Newbie
- Posts: 16
- Joined: Tue Sep 22, 2009 5:26 pm
Re: how to store images of a unique user in mysql using php
thanks all for ur advice