mysql and images

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Ilya Knizhnik

    mysql and images

    Hello everyone,

    I have a couple questions and I am wondering if anyone could point me in
    the right direction.
    What I want to do, is the following...
    Upload an image (most likely jpeg), display it and store it in a mysql db
    right after upload, without storing a copy on the server and
    then referencing the file.
    Have another script that gets the image from the db and displays it once
    again without storing copies on the server.

    to upload its just

    <form enctype="multip art/form-data" action="uphome. php" method = "post">
    <input type="hidden" name ="MAX_FILE_SIZE " value="500000">
    Upload this file: <input name ="userfile" type="file">
    <input type="submit" value="upload">

    then to reference the file.. should it be?
    $fp=$_FILES['userfile']['tmp_name']

    I'm not quite sure how to display it, without using copy or
    move_uploaded_f ile first.
    Just echoing the regular html <img scr=$fp > doesn't seem to work with the
    temporary path from tmp_name? unless I copy the file to some location
    which I don't want to do.

    I'm also not sure exactly how would I store and retreive the file from
    the db.
    is it just (after connecting to db) similar to
    mysql_query('in sert into table (column) values (\''.$fp.'\')';


    I seem to have found several different answers online, none of which
    worked for me, please point me in the right direction.

    Ilya
Working...