[Zope] http file upload w/ external methods.
Dieter Maurer
dieter@handshake.de
Fri, 9 Nov 2001 21:23:54 +0100
zope@virtosi.com writes:
> i am having upload issues. i would like to upload a file, some text,
> and meta-data (all form fields...) and then move (and rename) that file to
> a specific directory based on the meta-data.
>
> so,,, i am sending the requests directly to an External method.
>
> ### DTML ####
> <input type=my_external_method action=post enctype='multipart/form-data
What a strange "input" tag!
Looked like a garbled "form" tag...
> ....
> the LocalFS products manage_upload seems to do what i want, but i don't
> know how to access it from an external method (and i would need to for
> other reasons).
Give your external method a first parameter called "self".
When ZPublisher calls the method, it passes "PARENT[0]" (the
object traversed before the external method was reached) to "self".
You can then use acquisition from "self" to get all relevant
information, e.g. "self.localFSId", provided the "localFS" instance
can be accessed from the parent object via "localFSId".
> does Zope hand off the request directly to the external method?? could i
> use the cgiupload.py module ??
Yes and no.
Dieter