[Zope] passing ZPublisher.HTTPRequest.FileUpload instance between forms

Dieter Maurer dieter@handshake.de
Thu, 30 Aug 2001 21:34:45 +0200 (CEST)


Giuseppe Bonelli writes:
 > Is it possible to share a single instance of a ZPublisher.HTTPRequest.FileUpload object between different forms ?
 > 
 > In other words:
 > 
 > I have a file upload form where I load a file in the standard way whit a <input type="file" ...>
 > I then process the file in an external method (for ex. I check for the file type, and if it is a PDF I use pdfinfo to extract the properties embedded in the file)
 > I then call a second form which has some field eventually percompiled from the pdf properties returned from the external method
 > This second form must upload the file (as an extDocument), without the need of another <input type="file" ...>?
The file is already uploaded with the first form submit....

You may try to save the file object in a session object, but it
will almost surely not work.

You may save the file content and other relevant attributes
(like it name on the client) in a session object.
This will work as long as the file is not two big.

Otherwise, you should write the file to a temporary file
and keep that information in a session object.

Didn't you ask this question only recently?
I seems to me I had answered it already.


Dieter