How to save images in mysql table

Discussion in 'PHP' started by Ngajel, Aug 5, 2010.

  1. #1
    I have problem to save the uploaded images in the database. I am using mysql as database. Please can anyone help to me??
     
    Ngajel, Aug 5, 2010 IP
  2. codesmithnwessen

    codesmithnwessen Peon

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    one of the most easiest way is to upload an image in a particular folder and then save path in your mysql table. just google how to upload the images in php/mysql. cheers!!
     
    codesmithnwessen, Aug 6, 2010 IP
  3. HuggyEssex

    HuggyEssex Member

    Messages:
    297
    Likes Received:
    4
    Best Answers:
    2
    Trophy Points:
    45
    #3
    To just upload an image to a server use the copy function, google it for more information. And then using the $_FILE global you can save the filename to the database.

    
    mysql_query("INSERT INTO table (title,image) VALUES ('Title Here','".$_FILES['tmp_name']."')");
    
    PHP:
    Something like that.
     
    HuggyEssex, Aug 6, 2010 IP
  4. Kaizoku

    Kaizoku Well-Known Member

    Messages:
    1,261
    Likes Received:
    20
    Best Answers:
    1
    Trophy Points:
    105
    #4
    If you meant store the image in the database itself, you will need to use a binary type such as BLOB.
     
    Kaizoku, Aug 7, 2010 IP