Does anyone have any sample code for "storing" images in a mySQL database. I would like to be able to upload images and point an entry in a table to the file that was uploaded.

I am not sure if that is the correct way to store images....

Does anyone know how to answer this??

Van

    If you are not storing the file itself (which I have not done), you can simply store the filename in the database and that way you just have to read the filename out later to use the image.

    Er, if you need more detailed help, please say exactly what you know about using a database like if you have one setup, if you can create tables, if you can insert and select rows...

      Hi! Could you give answere for this mesage? I have no idea how about vbmurray noliges in SQL an PHP. But I would like see your ansver. archangel_617b!!! Are you from Russia?

        Well you don't need to save the image in the database (well depends) but I recomend you that you upload the file with a file input in your form, and the use the $FILES array in PHP to acces the information about the uploaded file, you can check the field of the $FILES array in the man. When you upload the file, you just nedd to move the file with move_uploaded _file.

        Hector.

        www.oksonora.com OKSonora

          One time I reed that creating images in SQL data base is not wery good idea. Becouse images could slow down (like car break) SQL server! I can just agree with you hrosas that beter way is creating PHP images upload function in to article and in the SQL just insert image link from image somsing like that! After that just get them from SQL .

          if ($story[picture])
          print "<IMG SRC=\"$story[picture]\" HEIGHT$height=80 WIDTH$width=60 ALIGN=LEFT>";

            read the file into a string then store the string in a BLOB field. Simple as that.

              Write a Reply...