Hi again,

I was able to use urllib2_file, which is a wrapper to urllib2.urlopen(). It
seems to work fine, and I'm able to retrieve the contents of the file using:
 
afile = req.form.list[1].file.read()

Now I have to store this text file (which is about 500k) and an id number into a
mysql database in a web server. I have a table that has two columns user id
(int) and mediumblob. The problem I have now is I don't know how to store them
into the database. I've been looking for examples without any luck. I tried
using load data infile, but it seems that I would need to have this client_side
file stored in the server. I  used load data local infile, and got some errors.
I also thought about storing them like this:

afile = req.form.list[1].file.read()
cursor.execute("""insert into p_report (sales_order, file_cont )
values (%s, %s)""", (1, afile))

I really don't know which is the best way to do it. Which is the right approach?
I'm really hoping someone can give me an idea how to do it because I'm finding
this a frustrating.

Thanks,
Patricia




_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to