[Zope] Newbie: uploading file with python script (problem with it)

Hans de Wit hw@scp.nl
Wed, 14 Mar 2001 17:20:06 MET


Hello,

I have a problem uploading files via a form and a python script.
The content of the uploaded file after uploading it is only a string, ie the name of the 
file, not the file itself. I followed the guestbook example of the Zopebook.
This is the receiving Python script.

 # create a unique file id
id='entry_%d' % len(context.objectIds())

# create the file
afile=context.REQUEST['afilename']
context.manage_addProduct['OFSP'].manage_addFile(id,afile)

***
afilename is a field on the form the "sending" form:
<form action="addFile">
Add file:<input type="file" name="afilename:string" size="30"><br>
<input type="submit" value="upload">
</form>

Thanks for any advice


Met vriendelijke groeten,

Hans de Wit

h.de.wit@scp.nl