hello, i develop a project with a mysql interface. one mysql table holds all the images for my project.
everything works quite well so far, except i'm not able to upload images into the database. the following function does the mysql UPDATE, it requires the image and the image ID as arguments. additionally it dumps the image to my filesystem ('/tmp/image.gif') - i test this with gif images. for some reason, the file dumped to /tmp/image.gif is exactly the same as uploaded, but in mysql the file is corrupted, far to small and not even viewable. here is my function: def i_update(image, imgid): image = "%s" % (image) sql_exec = """UPDATE Images SET Image='%s' WHERE ImgID = '%s' """ % (image, imgid) o = open("/tmp/file.jpg", "w") o.write(image) o.close() db_connect.cursor.execute(sql_exec) i've the strong feeling that the substitution makes problems. if the string 'image' conains ' or " for example, the sql_exec is broken. what do you suggest? bye jonas -- http://mail.python.org/mailman/listinfo/python-list