Zope, MySQL and pictures in blob-fields ...

Thilo Rößler nospam_t.roessler at v-d.com
Thu Sep 26 13:16:52 CEST 2002


Hello to everybody!

I'd like to provide users with a possibility to upload pictures into a 
MySQL-Database. Therefore I created a web-form (using method="post" and 
enctype="multipart/form-data") with an input for uploading files (<input 
type="file" name="VorschlagBild">). The action of the form calls a 
SQL-Method that stores the data received from the into a MySQL-table 
(insert into Vorschlag values([...]<dtml-sqlvar VorschlagBild 
type="string">)). The picture should be put into a blob-field. I used 
'type="string"' because "file" or something similar does not exist.
Finally, the record gets stored into the MySQL-database, but the picture 
isn't saved the way I expected. Taking a look at the content of the table 
using webmin, the appropriate field just shows 
"<ZPublisher.HTTPRequest.FileUpload instance at 0x893a7ec>".
Can anybody tell he how I manage to save/upload the picture and possibly 
even show it again in a website afterwards?

Thanks in advance, and sorry if it is a simple question ... I tried to find 
a solution but couldn't find one.

Thilo



More information about the Python-list mailing list