View Full Version : Profile Pictures

01-24-2008, 07:12 PM
Hi, I don't know how easy this is going to be, but I am trying to get a picture upload system on my website, so users can upload pictures and set one as their profile picture (like bebo and myspace)

I already have my engine set up, you can register, login, have a profile page with custom text on it, change various settings, friends list, friend search, video from youtube etc.

I know it should be easy, but I'm very new to php (I don't know why on earth I'm trying to create a website like this but who cares :P)

If anyone wants snippets of my code I can post it.

01-24-2008, 09:17 PM
This is surprisingly easy to do. If you Google "php image upload" or something similar, you can find lots of tutorials and stuff.

It's really as simple as having this in your form:

<input type="file" name="image" />

And when you submit your form, you can work with the uploaded image like this:

if (!empty($_FILES['image']['name'])) {
//At it's most basic form, all you have to do it move the file from its temp
//location into a directory on your server
$tmp_name = $_FILES['image']['tmp_name'];
$image_name = $_FILES['image']['name'];

$move = @move_uploaded_file($tmp_name, '/var/www/vhosts/domain.com/httpdocs/upload/' . $image_name);

I do lots more things, like checking the extension of the image, checking the file size, resizing the image, etc. All of which I found out from tutorials online. Good luck! :)

01-24-2008, 09:29 PM
im also creating website.... if you wanna exvhnage ideas i can as i would love to look into how you have done friend lists and friend searches.... i will be happy to supply you with my image upload codes and explain how the work to you

01-25-2008, 02:34 AM
runnerip, how are you managing to pay for all of this hosting?

uploading images and videos costs a lot of money when people access them from your server.

01-25-2008, 08:34 AM
I have a 5TB Bandwidth limit

01-25-2008, 11:49 AM
5TB per month?

may I ask where your hosting is?

01-25-2008, 01:48 PM
5tb thats mmore then mine what is it... atm im on cheap 1... i dont see point in paying lots of money for bandwith im not yet using... once i hit my monthly badwith then i will upgrade :P

01-25-2008, 04:30 PM
Ok, I replied to both your Pm's

If anyone else wants to know my host it is Siteground (http://www.siteground.com/index.htm?referrerid=37298)