[Seaside] [Q] File Upload/Download Server, Comanche or Swazoo

Philippe Marschall philippe.marschall at gmail.com
Fri Aug 1 16:54:06 UTC 2008

2008/7/29 Janko Mivšek <janko.mivsek at eranova.si>:
> Philippe Marschall wrote:
>>> I don't understand how there is no way to know which input fields will be
>>> file ones. Web framework is naming them during HTML generation anyway, I
>>> suppose Seaside too?
>> Yes, in a non-predicable way (for the server adapter). Even if it
>> would generate them in a predictable way there would still be a
>> problem if you have multiple file upload fields in the same form.
> In Aida there is completely predictable way to generate names and pair them
> with forthcoming POST. I therefore don't see the reason why Seaside can't do
> something similar.
> See for example image upload in http://squeaksite.aidaweb.si/About/ (login
> as demo/demo, then edit that page and see Attach image IFRAME). If we look
> at source of this IFRAME, there we have the following input fields:
> ...
> <form  method=post action="/About/?view=images&version=2"
>   enctype="multipart/form-data">
>  ...
>  <input type="hidden" name="id5273" value="images">
>  <input type="file" name="field3">
>  <input type="submit" name="field4" value="Upload">
>  ...
> </form>
> As you can see field names are auto generated and Aida register them
> internally so that fields can be paired with post data in forthcoming POST.

I wonder how this works together with the back button. If we'd do that
we'd end up implementing half of Seaside in the server adapter. All
the session, callback probably even state and continuation logic would
have to be there.

> For streaming this pairing must not occur until you don't know the
> destination file, so you must not read post data from POST until then. This
> is maybe your problem, you read too fast post data in your adapter. End
> result in that case is that you stream the upload "in the air", because
> target stream is unknown.

A Seaside server adapter does very little work. All it does is it
converts a "native" request to a Seaside request and a Seaside
response to a "native" response. It doesn't know anything about
sessions, continuations, callbacks, components, applications or any
other Seaside implementation detail. It just delegates to an object
that understands #handleRequest:. This makes server adapters quite
small and easy to implement. It allows us the change the way Seaside
works without changing the server adapter (mostly). You can also take
this and build something completely different than Seaside and have it
running on different dialects (Squeak, Gemstone, CST, GST, Dolphin,
VAST, ...) and different servers (Kom, Swazoo, Swzaoo 2, OpenTalk,
FastCGI, ...) without any code change. That's for example what RSRSS

All I want to do is to stream the fields that are files. Which fields
are files is encoded in the request. Why for example can't I just
iterate over the POST fields while they are being read? Look at each
one and see whether it is a file upload or not and if it is then
stream it. All this information can be parsed incrementally from the
request without the need to fully parse it first. In fact this is what
Kom and commons-fileupload do.


More information about the seaside mailing list