SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Member
    Join Date
    Jul 2003
    Location
    SC
    Posts
    18
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    uploading & viewing picure

    I know how to code "browse" so that a webuser can upload his/her picture to my website, but how does one view the picture.

    I guess my question is how one upload his/her picture, like on a dating site, without having userid and password of the owner's server?

    Some code would be nice.

    --Scott
    bugapest@yahoo.com

  2. #2
    La la la la la bronze trophy lieut_data's Avatar
    Join Date
    Jun 2003
    Location
    Waterloo, ON
    Posts
    1,517
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by splitfire2
    ...upload his/her picture,...
    Uploading, in terms of a web-browser, is always handled by the "browse" code (as you mentioned). There is no reason why the user would provide you with FTP access to his remote server (I'm not even sure how this is relevant)

    Either way, once the file has been uploaded, you will need to write the file to disk (or copy it from the temp directory). I'd recommend looking at the PHP Manual on File Uploading (see link).

    Once you have saved the file, with a unique file name, simply map this file name to each user's account (whther by a database or however you currently store their details). Load up the image when the user's profile is called, and you are all set :-)
    My name is Steve, and I'm a super-villian.

  3. #3
    SitePoint Member
    Join Date
    Jul 2003
    Location
    SC
    Posts
    18
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hey, thanks.

    You wouldn't have a snippit of code that I peruse, would you?

    --Scott
    bugapest@yahoo.com

  4. #4
    La la la la la bronze trophy lieut_data's Avatar
    Join Date
    Jun 2003
    Location
    Waterloo, ON
    Posts
    1,517
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    A snippet?

    Straight from the PHP Manual:

    PHP Code:
    $uploaddir '/var/www/uploads/';

    print 
    "<pre>";
    if (
    move_uploaded_file($_FILES['userfile']['tmp_name'], $uploaddir $_FILES['userfile']['name'])) {
        print 
    "File is valid, and was successfully uploaded.  Here's some more debugging info:\n";
        
    print_r($_FILES);
    } else {
        print 
    "Possible file upload attack!  Here's some debugging info:\n";
        
    print_r($_FILES);

    My name is Steve, and I'm a super-villian.

  5. #5
    SitePoint Member
    Join Date
    Jul 2003
    Location
    SC
    Posts
    18
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks liet, I'll study code.

    If you would ever like to code a small script using php with a mysql table as an example(something real simple) with a couple customers added to database(say a pic of themselves), I'll be happy to send you $20 for your time.

    Feel free to email me personally at: bugapest@yahoo.com

    --Scott


Bookmarks

Posting Permissions

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