SitePoint Sponsor

User Tag List

Results 1 to 6 of 6

Hybrid View

  1. #1
    SitePoint Enthusiast
    Join Date
    Oct 2000
    Posts
    39
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm creating a page for an IRC-channel, where users can add info about theirselves and some other things.
    I want the uploaded image's new url (on my server) inserted into a database together with all other information.

    Any ideas how to solve this? //Magnus

  2. #2
    SitePoint Author Kevin Yank's Avatar
    Join Date
    Apr 2000
    Location
    Melbourne, Australia
    Posts
    2,571
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    The issues involved are discussed in the last chapter of my PHP/MySQL article:

    Handling File Uploads
    Kevin Yank
    CTO, sitepoint.com
    I wrote: Simply JavaScript | BYO PHP/MySQL | Tech Times | Editize
    Baby’s got back—a hard back, that is: The Ultimate CSS Reference

  3. #3
    SitePoint Enthusiast
    Join Date
    Oct 2000
    Posts
    39
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks alot Kevin
    I think I know how to handle this =)

  4. #4
    SitePoint Enthusiast
    Join Date
    Oct 2000
    Posts
    39
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Kevin, This works just fine.. but there's one problem..
    I want the url to my file linked.. not the path on my hd...
    How do I do that?

  5. #5
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You can either create the link with the image name and then insert it into the database or you can just store the image name and create the link to it when you need it.

    Before inserting to database, if your file input field was named "userfile"
    $imageurl = "http://www.yourdomain.com/images/".$userfile_name;

    Then insert $imageurl into the db.

    Or when you need to create the link on the other end, when displying data simply construct the url and tack on the image name form the db


    $imageurl = "http://www.yourdomain.com/images/".$row["imagefield"];
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  6. #6
    SitePoint Enthusiast
    Join Date
    Oct 2000
    Posts
    39
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That cat amazes me everytime
    Thanks


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
  •