Hi; I have the following archaic code that worked just fine for another site. It is called with the following url:
http://13gems.com/stxresort/cart/getpic1.py?id=1&x=1 #!/usr/local/bin/python import cgitb; cgitb.enable() import MySQLdb import cgi import sys,os sys.path.append(os.getcwd()) from login import login user, passwd, db, host = login() form = cgi.FieldStorage() picid = int(form['id'].value) x = int(form['x'].value) pics = {1:'pic1',2:'pic2',3:'pic3',4:'pic4',5:'pic5',6:'pic6'} pic = pics[x] print 'Content-Type: text/html' db = MySQLdb.connect(host=host, user=user, passwd=passwd, db=db) cursor= db.cursor() sql = "select " + pic + " from products where id='" + str(picid) + "';" cursor.execute(sql) content = cursor.fetchall()[0][0].tostring() cursor.close() print 'Content-Type: image/jpeg' print print content Now, the data is in the database: [BLOB - 64.0 KB] and I can get it to print out as a string. Why doesn't it show the image? TIA, Victor
-- http://mail.python.org/mailman/listinfo/python-list