Newbie: uploading file with python script (problem with it)
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
From: Hans de Wit <hw@scp.nl>
Add file:<input type="file" name="afilename:string" size="30"><br>
Is this actually this way in the Zope Book? The ":string" should not be there, and the enclosing <form> should have: METHOD="POST" ENCTYPE="multipart/form-data" ...as attributes. Cheers, Evan @ digicool & 4-am
participants (2)
-
Evan Simpson -
Hans de Wit