help in php??

Discussion in 'PHP' started by mahiraj, Oct 23, 2007.

  1. #1
    Hi All,

    Anybody can tell me how can i insert images into the database???
    like as on line submit images option. If possible please provide me the script.

    Thanks in advance.
     
    mahiraj, Oct 23, 2007 IP
  2. Maxim.Cerny

    Maxim.Cerny Active Member

    Messages:
    156
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    51
    #2
    Hello,

    it's not a good idea to insert raw image into database. It's better to store it in the filesystem (e.q. /photogallery/PhotoID.jpg).

    If you want to insert image into DB, try to inserting it as BLOB.
     
    Maxim.Cerny, Oct 23, 2007 IP
  3. thenetninja

    thenetninja Peon

    Messages:
    314
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #3
    agreed, storing binary in a database is asking for problems. Better to store the filename location.
    Oh, and files over 80kb or so should be stored in a field as LONG BLOB or else your images will come through corrupted.
    But I still don't recommend it
     
    thenetninja, Oct 23, 2007 IP
  4. mahiraj

    mahiraj Guest

    Messages:
    47
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    no i do not want to store image in a table i want to store its path only so what will the sql query for that. my all images are store is specific folder.
     
    mahiraj, Oct 23, 2007 IP
  5. padmore

    padmore Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    select filename from file_table where client_id=12


    then you can concatenate the directory name to the file name
    print "<img src=$dir.$filename>"

    -Shelon Padmore
     
    padmore, Oct 23, 2007 IP