upload files from forms
Anybody tried using the form wiht file input type. Zope uses this to upload html files from user's disk. Question is how does it access the file in the form variables. I cannot see anything in the request that shows a file. When I access the file variable all I can see is a file name that the user entered. Any ideas ? Thanks sathya rangaswamy
linuxcraft@scorpio.redspice.com wrote:
Anybody tried using the form wiht file input type. Zope uses this to upload html files from user's disk. Question is how does it access the file in the form variables. I cannot see anything in the request that shows a file. When I access the file variable all I can see is a file name that the user entered. Any ideas ?
the object that zope uses to download file data is an instance of the ZPublisher.HTTPRequest.FileUpload class. you can access the fully qualified filename through its "filename" attribute. you can pass the object into an External Method, where it works similar to a filehandle, or use it in DTML's manage_addFile() or manage_addImage(). see zope/lib/python/ZPublisher/HTTPRequest.py for the definition of FileUpload and zope/lib/python/OFS/Image.py for details about the manage_add*() routines. there's no further documentation that I know of, but the source is commented... hope this helps, Heiko -- Heiko Stoermer MIG Augsburg
linuxcraft@scorpio.redspice.com wrote:
Anybody tried using the form wiht file input type. Zope uses this to upload html files from user's disk. Question is how does it access the file in the form variables. I cannot see anything in the request that shows a file. When I access the file variable all I can see is a file name that the user entered. Any ideas ?
<dtml-var "file.read()"> will spill the contents of the file. -Michel
Thanks sathya rangaswamy
_______________________________________________ Zope maillist - Zope@zope.org http://www.zope.org/mailman/listinfo/zope
(To receive general Zope announcements, see: http://www.zope.org/mailman/listinfo/zope-announce
For developer-specific issues, zope-dev@zope.org - http://www.zope.org/mailman/listinfo/zope-dev )
participants (3)
-
Heiko Stoermer -
linuxcraft@scorpio.redspice.com -
Michel Pelletier