[Zope] - Import file via HTTP

Dieter Maurer dieter@handshake.de
Wed, 27 Nov 2002 19:51:05 +0100


Jessica Niewint writes:
 > 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 ...
"<a href..>" following results is a "GET" request.

You must use a POST request. Its "Content-Type" must be "multipart/form-data"
and you must send the file content and not its name.

This is best done with a higher level tool, such a
"ZPublisher.Client", than by hand.

In HTML, you can get this with a

  <form method=POST enctype="multipart/form-data" action="...manage_addFile">
     ...
     <input type=file name=file>
     ...
  </form>

For security reasons, the browser will not allow you to preset
the file name but your user must select the file with a file
dialog. You might (I do not know) be able to work around this
with Javascript.


Dieter