Zope, MySQL and pictures in blob-fields ...
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. SInce I am unsure if this one should be posted to the RDBMS-list, I started here ... if this was wrong: Sorry! Thilo -- Werden Sie mit uns zum "OnlineStar 2002"! Jetzt GMX wählen - und tolle Preise absahnen! http://www.onlinestar.de
I think you want to use the data attribute of the filename. For example, if the input field is named "filename", you should use the contents of filename.data as input to your blob column in the database. Kevin -----Original Message----- From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of el-nino@gmx.li Sent: Thursday, September 26, 2002 9:34 AM To: zope@zope.org Subject: [Zope] Zope, MySQL and pictures in blob-fields ... 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. SInce I am unsure if this one should be posted to the RDBMS-list, I started here ... if this was wrong: Sorry! Thilo -- Werden Sie mit uns zum "OnlineStar 2002"! Jetzt GMX wählen - und tolle Preise absahnen! http://www.onlinestar.de _______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
participants (2)
-
el-nino@gmx.li -
Kevin Carlson