[Web-SIG] Multipart/multiple stream file uploads.

Alan Kennedy py-web-sig at xhaus.com
Wed Oct 6 16:13:14 CEST 2004


[Ian Bicking]
 > I think middleware would have to modify the input stream if it wanted
 > to  parse POST variables.  In that case, you might parse the input
 > stream, while also constructing a replacement input stream for when
 > the application tries to re-read the stream.  In effect the middleware
 > wants to peek at the input stream.

Reading this put me in mind of a potential use case that any WSGI input 
API will have to cover: that of multiple streamed file uploads.

So for example that the user is uploading a set of form variables, *and* 
multiple files, each in a MIME multipart sub-message.

Say further that on the server-side we want to stream each of the files 
into disk without buffering them to memory, as well as access the form 
variables from the first MIME multipart.

In this case, the file stream for the second file stream (i.e. the third 
multipart) cannot be made available to the WSGI application until the 
first file has been processed/saved to disk.

How could an asynchronous API support such multiple file uploads? As 
well as process/present form data from the first part? Would it have to 
register callbacks for "a new multipart has arrived" events?

I don't have a proposed solution, I just thought it was worth raising 
the use case, for discussion purposes.

Regards,

Alan.



More information about the Web-SIG mailing list