[Zope] How do I test for file to upload (or not) via REQUEST data?

Small Business Services toolkit at magma.ca
Sat Mar 27 07:38:51 EST 2004


From: "John Schinnerer" <johnschinnerer at yahoo.com>
> My main need now is the below question - how to test if there is a file
> to be uploaded or not by checking in REQUEST somehow.

If you use the standard html input tag to get the user to select a file

eg.   <input type="file" name="fname">


Then what you see in REQUEST is 'fname' as a 'fileupload instance' (not a
file name).  'fname'  has  an attribute called 'filename', which you can use
as follows:

<dtml-call "REQUEST.set('title', fname.filename)">
<dtml-call "manage_addFile(id=REQUEST['id'], file=REQUEST['fname'],
title=REQUEST['title'])">

HTH

Jonathan





More information about the Zope mailing list