[Zope] upload file from filename

John Ziniti jziniti@speakeasy.org
Thu, 28 Feb 2002 21:59:46 -0500


You really need to send in the "filename" as the value of a
browser "<input type=file>" form element.  In short, the
file name is not enough info ... the form element passes in
a file handle as well, allowing the upload.

Ziniti

John Hunter wrote:

>>From a Python Script, given a string which is a filename on the local
>filesystem, say,
>
>    thisFile = 'C:\\ProgramFiles\\SomeDir\\somefile.dat'
>
>How can I upload this to the zope filesystem?
>
>I naively tried:
>
>    folder.manage_addFile(id='somefile.dat', file=thisFile )
>
>But of course this created a file somefile.dat with contents
>'somefile.dat' because the 'file' argument contains the content, not
>the name, of the file.
>
>Any suggestions?
>Thanks,
>John Hunter 
>
>_______________________________________________
>Zope maillist  -  Zope@zope.org
>http://lists.zope.org/mailman/listinfo/zope
>**   No cross posts or HTML encoding!  **
>(Related lists - 
> http://lists.zope.org/mailman/listinfo/zope-announce
> http://lists.zope.org/mailman/listinfo/zope-dev )
>
>