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

Nick Garcia ngarcia@codeit.com
Wed, 15 Mar 2000 14:01:26 -0800


Marius Kjeldahl wrote:
> 
> 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?

REQUEST['file'].read ()
                    ^
            Notice this space?

That space isn't supposed to be there.  You're supposed to be calling a
function with no arguments, the () has to be right next to the "read". 
The way you have it right now, it's looking for an attribute called read
instead of a function.

-- 
Nick Garcia | ngarcia@codeit.com
CodeIt Computing | http://codeit.com