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

Philippe Marschall philippe.marschall at gmail.com
Tue Jul 29 11:01:11 UTC 2008

2008/7/29 Janko Mivšek <janko.mivsek at eranova.si>:
> Philippe Marschall wrote:
>>> See this example from http://www.swazoo.org/streaming.html:
>>> Site>>answerTo: aHTTPRequest
>>>  | stream |
>>>  aHTTPRequest
>>>   postDataAt: 'file'
>>>   beforeStreamingDo: [:datum |
>>>     stream := (SpFilename named: datum filename) writeStream.
>>>     datum writeStream: stream].
>>>  aHTTPRequest ensureFullRead. "to be sure streaming occurs"
>>>  stream close.           "mandatory, to close open stream! "
>>>  ^HTTPResponse ok
>>> In that example we open a file named as the original file, which  is sent
>>> in
>>> request as post data, just before a file content.
>>> I hope that helps
>> Nope sorry. See the attached code. Your example and the attachment
>> work only if there is an upload filed with the name 'file'. That's the
>> only upload filed that will be streamed. That's why the attached code
>> breaks. If you change the name of the upload field to 'file' then the
>> code breaks somewhere in MultiByteFileStream (Squeak 3.9 Mac VM).
> Philippe, first sorry for late answer. Time pressures ...
> I looked at your code, where you make a subclass of Site where is a test
> form with file input field , then post via streaming to output file.
> Problem is that you named file input field as "upload" while in my example
> it is expected to be "file". So, just adjust those two names and your
> example should work.

Nope sorry, the example code was written explicitly to illustrate the
problem. Upload streaming with Swazoo works only iff you know
beforehand which fields will be files. There is now way how I can know
this. Compare this to the upload streaming of Kom which detects which
fields are files.

And even then the Swazoo code still breaks in MultiByteFileStream.


More information about the seaside mailing list