Re: [Zope] file upload from python script
When I try manage_addFile or manage_upload, the content of the new > > is the path of the file I wanted to upload and not the file itself.
This means, you should pass the FileUpload object and not the filename :-)
The problem is: "I'm trying to do a file upload from inside a python script that takes the file's PATH and the target folder object as args." OK, but I wouldn't have to write a python script if I already had the FileUpload object corresponding to the file I want to upload - I could use manage_addFile or manage_upload then. I know how to get a FileUpload object using a <input type="file">-tag in a dtml-Document. But I want to do the upload automatically: I have a python script A with a list of (PathOfFileToUpload,TargetFolderObject)-pairs which is to call a python script B for each item in the list, handing over to it the path of the chosen file and the target folder B is supposed to upload the file into? I then have to convert the file's path into a FileUpload object first and then use manage_upload with it, like def B(TargetFolderObject,PathOfFileToUpload): TargetFolderObject.manage_upload(FileUploadObject(PathOfFileToUpload)) So my remaining question is: how do I create a FileUpload object from the chosen file's path? Thanks nevertheless Horst _________________________________________________________________ Downloaden Sie MSN Explorer kostenlos unter http://explorer.msn.de/intl.asp
participants (1)
-
Horst Wald