[Zope] FileUpload, MySQL, Zope ZSQL problem

Dieter Maurer dieter at handshake.de
Wed Jan 21 15:07:05 EST 2004


Quince Gibson wrote at 2004-1-21 09:37 -0500:
>Tried finding an answer to this question but I can't.  I'm trying to upload pictures to a MySQL database with the 
>normal conditions:
>
><input type="file" name="picture1">
>enctype="multipart/form-data"
>method="post"
>
>My ZSQL method has the following DTML:
><dtml-var expr=picture1.data>

I fear, some background reading about DTML would be an advantage...

What should the above give you? The file content?

  This would be '<dtml-var expr="picture1.read()">'

You get uploaded files as "ZPublisher.HTTPRequest.FileUpload"
objects. Read the respective source documentation
in "ZPublisher/HTTPRequest.py", for details...

>I've also tried the same thing with dtml-sqlvar using type=string.
>
>I'm always greeted with the following error whenever I feel I'm going to make a breakthrough:
>
>FileUpload instance has no attribute 'data'

This message is as clear are an error message can be.
"picture1" does not have an attribute "data".
The documentation mentioned above tells you which
attributes it has...

>removing the ".data" section gives me:
><ZPublisher.HTTPRequest.FileUpload instance at 0x932c35c>
>as the entry for that particular field.

The database adapter converted the file object into a string.
You see the result above...


-- 
Dieter



More information about the Zope mailing list