Start New Discussion Reply to this Discussion store image in blob type of mysql
Hi all,
i am new to python
how to store image into database blob using python
please help me for this its urgent
Related Article: saving image file in database
is a Python discussion thread by rajeshwari_ib that has 2 replies and was last updated 3 years ago.
rajeshwari_ib
Newbie Poster
8 posts since Dec 2009
Reputation Points: 8
Solved Threads: 0
Skill Endorsements: 0
Hi,
first of all storing a BLOB is very bad design.
But, it would be like this:
blob_value = open('image.jpg', 'rb').read()
sql = 'INSERT INTO Tab1(blob_field) VALUES(%s)'
args = (blob_value, )
cursor.execute (sql, args)
connection.commit()
programmersbook
Junior Poster
121 posts since Nov 2009
Reputation Points: 29
Solved Threads: 30
Skill Endorsements: 0
Hi,
first of all storing a BLOB is very bad design.
But, it would be like this:
blob_value = open('image.jpg', 'rb').read()
sql = 'INSERT INTO Tab1(blob_field) VALUES(%s)'
args = (blob_value, )
cursor.execute (sql, args)
connection.commit()
Thanks yar your code is working fine.
rajeshwari_ib
Newbie Poster
8 posts since Dec 2009
Reputation Points: 8
Solved Threads: 0
Skill Endorsements: 0
thanks yar your code is working fine
rajeshwari_ib
Newbie Poster
8 posts since Dec 2009
Reputation Points: 8
Solved Threads: 0
Skill Endorsements: 0
© 2013 DaniWeb® LLC
Page generated in 0.0592 seconds
using 2.64MB