[Zope] zpublisher instance
J Cameron Cooper
jccooper at jcameroncooper.com
Tue Aug 26 19:44:42 EDT 2003
>Just joined the list; be gentle with me!
>
>How do I reference a ZPublisher.HTTPRequest.FileUpload instance?
>
>I can see the content type and content length with REQUEST, so I know the
>file is there. I also know that the FileUpload instance is a Python
>file-like object. That's what I want because I want to read it. But, how
>do I get to the thing? Is it part of the REQUEST object?
>
>I've tried using a script and an external method but no luck.
>
>
Don't overthink it. It's just like you'd access any request parameter,
save that it's a Python file-ish object.
Say you did::
<form method="post" action="blerg">
<input type="file" name="somefile" />
<input type="text" name="sometext" />
<input type="submit" />
</form>
Then in 'blerg' (a Python script) you could say::
fileobj = REQUEST.somefile
stringobj = REQUEST.sometext
to get a handle on the parameters. (Or any of the other ways the REQUEST
object allows access to request parameters.) The only difference is that
one is a string and one is a FileUpload file-ish object.
--jcc
More information about the Zope
mailing list