Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 8 of 8
  1. #1
    Regular Coder Ludatha's Avatar
    Join Date
    Jan 2008
    Posts
    250
    Thanks
    51
    Thanked 5 Times in 5 Posts

    Profile Pictures

    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.

  • #2
    Super Moderator JohnDubya's Avatar
    Join Date
    Nov 2006
    Location
    Missouri
    Posts
    634
    Thanks
    12
    Thanked 18 Times in 18 Posts
    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:

    Code:
    <input type="file" name="image" />
    And when you submit your form, you can work with the uploaded image like this:

    PHP Code:

    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!

  • #3
    Regular Coder
    Join Date
    Nov 2006
    Posts
    601
    Thanks
    1
    Thanked 2 Times in 2 Posts
    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

  • #4
    Regular Coder
    Join Date
    Dec 2006
    Posts
    417
    Thanks
    168
    Thanked 1 Time in 1 Post
    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.

  • #5
    Regular Coder Ludatha's Avatar
    Join Date
    Jan 2008
    Posts
    250
    Thanks
    51
    Thanked 5 Times in 5 Posts
    I have a 5TB Bandwidth limit

  • #6
    Regular Coder
    Join Date
    Dec 2006
    Posts
    417
    Thanks
    168
    Thanked 1 Time in 1 Post
    5TB per month?

    may I ask where your hosting is?

  • #7
    Regular Coder
    Join Date
    Nov 2006
    Posts
    601
    Thanks
    1
    Thanked 2 Times in 2 Posts
    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

  • #8
    Regular Coder Ludatha's Avatar
    Join Date
    Jan 2008
    Posts
    250
    Thanks
    51
    Thanked 5 Times in 5 Posts
    Ok, I replied to both your Pm's

    If anyone else wants to know my host it is Siteground


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •