[Seaside] How to make an upload page

Damon Anderson damon@spof.net
Fri, 22 Mar 2002 14:58:46 -0600


Julian Fitzell writes:
 > What would you want the behaviour to be? Should it dump the data to a
 > temporary file somewhere and give you the filename? Should it return
 > a stream object with data in it that you could write to a file? I'm
 > assuming the former might be better since you don't know how big the
 > file might be and probably don't want to keep it all in memory.

My preference is also a stream object. It's easy enough to reject the
upload completely based on the Content-Length: header if it's too large.
If it's not too large I think streams are more useful, especially since
file uploads often end up in a database or something anyway. Also, with
a stream-based approach Seaside can always write it to a file, re-open
it, and return the stream, if it needs to, right? You could even have
several size thresholds, for "keep in memory", "write to file and return
file stream", and "reject completely."