[Seaside] Re: What alternative for fileUpload with WAFile for large files?

Van Upboy van.upboy at gmail.com
Wed Mar 24 10:52:22 UTC 2010


Hi all,

I've started some detective work and I've found this:

urlForDocument: anObject mimeType: mimeType fileName: fileName
    ^ (self registry urlForRequestHandler:
        (WADocumentHandler
            document: anObject
            mimeType: mimeType
            fileName: fileName)) displayString

That seems to suggest that it is possible to download an Object when
clicking on a link.

Then I found this about document:

Instance Variables:
    document    <ByteArray | GIFImage | Image | String | WACachedDocument |
any class that understands #asMIMEDocumentType:>    contents of the document
    fileName    <String>    file containing the document to be sent as an
attachment, nil if no such file
    mimeDocument    <MIMEDocument>    MIMEDocument object representing this
document and mimeType, generates stream used to write document for the
response.
    mimeType    <String>    standard HTTP mime type

This seems to suggest that a MIMEDocument should be used. That has a
subclass of MIMELocalFileDocument which can have a fileStream. Which I think
it what I'm looking for if I want to serve a file directly.

So is this the way I should do it?
1. create a file stream (to be honest, I don't know how to yet, but this
seems fairly standard)
2. put it in aMIMELocalFileDocument contentStream: theFileStream
3.use that in the anchor
   document: aMIMELocalFileDocument
   mimeType: aMIMELocalFileDocument asMIMEDocumentType
   fileName: 'some filename here'
   with: 'some filename here'

I would really like some feedback on this one, thanks!


2010/3/23 Van Upboy <van.upboy at gmail.com>

> Hello,
>
> I'm using fileUpload (seaside 2.8), which uses a WAFile to store the
> contents directly. However, this doesn't work for (very) large files,
> because pharo will run out of memory. Likewise, an anchor like this:
>     html anchor
>         document: aWAFile contents
>         mimeType: aWAFile contentType
>         fileName: aWAFile fileName;
>         with: aWAFile fileName.
> won't work, because I can't serve the content directly from memory.
>
> I'm new to SmallTalk & Seaside, and I'm wondering how I should approach
> this problem?
>
> With kind regards,
> Van.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/seaside/attachments/20100324/0c7f3d37/attachment.htm


More information about the seaside mailing list