[Zope] - Import file via HTTP

Jessica Niewint j.niewint@kiosco.org
Wed, 27 Nov 2002 14:37:51 +0100


Ok I did the following:
in my url I call the manage_addFile like this:
<a 
href="http://my.server.com:8080/test/manage_addFile?id=myZope.pdf&file=/usr/exchange/my.pdf">LINK</a>
but in this case Zope insert the Path information 
'/usr/exchange/my.pdf'   ...and not the file itself. I quit sure this is 
stupid mistake ...




>Somehow, the file must come to Zope.
>
>   When it comes from a "MySQL" database, then you get the
>   files content and pass this as a string to
>   "manage_addFile". It will create a file object with the
>   given string as content.
>   You may need to specify "content_type" as guessing it
>   is more difficult from a string than a "ZPublisher.HTTPRequest.FileUpload"
>   instance.
>   You can call "manage_addFile" in e.g. a Python Script or External Method
>   (it probably will look somewhat like:
>   "destination.manage_addProduct['OFSP'].manage_addFile(...)")
>
>   When your file comes via HTTP, you send the files content
>   in a POST request to Zope. When the generation
>   is done with Python, I suggest to use "ZPublisher.Client"
>   as HTTP client.
>   When it is done in e.g. Java, there (probably) are similar
>   tools to send HTTP POST requests.
>
>
>Dieter