[Zope] Re: File from Zope to Filesystem

Paul Winkler pw_lists@slinkp.com
Tue, 10 Dec 2002 10:40:43 -0800


You should really direct your questions to the list, not to me.
I'm cc'ing the list.

On Tue, Dec 10, 2002 at 04:49:49PM +0100, Coanda, Mihai wrote:
> Hi,
> 
> I have a form
> 
> <form method="POST" action="processForm_localFS"
> enctype="multipart/form-data">
>   File or Image: <input type="file" name="filex" value="" /> <br />
>   <input type="submit" name="save" value="Upload" />
> </form>
> 
> and this is evaluated by the following DTML Method processForm_localFS :
> 
> <dtml-call "REQUEST.set('new_id', ZopeTime().strftime('%Y%m%d%H%M%S'))">
> <dtml-if filex>
> <p>Variable "filex" exists and has the value "<dtml-var
> "_.str(REQUEST.filex)">".</p>
> </dtml-if>
> <dtml-var REQUEST>
> <dtml-comment>
> <dtml-call "testerx.manage_upload( filex, new_id )">
> 
> 
> This returns:
> ============
> 
> Variable "filex" exists and has the value "".

Look at the html source, inside the quotes.
I bet you'll see <ZPublisher.HTTPRequest.FileUpload instance at e41414>
 
> form
> filex <ZPublisher.HTTPRequest.FileUpload instance at e41414> 
> 
> 
> How can I find the name and the path of the filex?

Name:  filex.filename
Path: I don't think you can. But you might have a look at filex.headers,
maybe there's something useful in there. I forget.

--PW

-- 

Paul Winkler
http://www.slinkp.com
"Welcome to Muppet Labs, where the future is made - today!"