[Zope] Zclass subclassing Image - how to manage uploads?

Marius Kjeldahl marius@funcom.com
Wed, 15 Mar 2000 22:39:15 +0100


Michel Pelletier wrote:
> 
> Your form element should be:
> 
> <input type=file name="file_name:file">
> 
> The ':file' is necessary to marshal the file into a file object.  I was
> going on the assumption that you had done that otherwise as you've
> discovered it will turn it into a string, which you may or may not want.

Ok, I have changed my form element to what you suggested. These are the
results I am getting with various <dtml-call> tags in the VProduct_add
method (called after filling in VProduct_addForm):

* <dtml-call "REQUEST['file'].read ()">

Error Type: TypeError
Error Value: argument file was ommitted

I guess this is because no field in the form is named 'file'. So I try:

* <dtml-call "REQUEST['file_name'].read ()">

..and I get the same error. I even tried to name="file:file" in the form
element, and using REQUEST['file'].read () in the call, but then I get:

Error Type: AttributeError
Error Value: 'string' object has no attribute 'read'

which I guess means that it now has the 'file' variable, but it is still
a string.

Any other pointers, or references to where I can read more about the
file stuff?

Thanks in advance,

Marius Kjeldahl