putting Image from database in cgi app

vivek kumar gupt_vive at hotmail.com
Wed May 21 06:56:52 EDT 2003


Hi all,

  I was wondering if there is any way to show the file read from database in 
the cgi app..
ie. When I read an image from database it is read in a buffer. So, currently 
what I am doing is creating a temporary file, writing the buffer in that 
file and showing that file in the cgi app something like:

   cur.execute("select pic from pictest where id=1")
   rst=cur.fetchone()
   s=open("temp.jpg","wb")
   s.write(rst[0])
   s.close
   print '<img src="temp.jpg">'

So, I was wondering if there is any way in which I can show the file 
directly without creating an intermediate file???

TIA
Kind Regards
Vivek Kumar

_________________________________________________________________
Go where the action is. Get MTV Citibank card. 
http://server1.msn.co.in/msnleads/citibankcards/mtv.asp It's cool!






More information about the Python-list mailing list