[Seaside] Making a download page

Avi Shefi avishefi at gmail.com
Thu Mar 10 08:46:33 UTC 2011


Amir,
The path to the file should be:
(a) accessible to the image you're running, and of course allowed by its
file permissions.
(b) generally an absolute path, however your nginx configuration might need
a tweak to set this up. Maybe you're missing something that nginx requires?
take a look: http://wiki.nginx.org/XSendfile

Additionally, I don't understand why you're passing a MultiByteFileStream if
all you need is the path to the file.


Avi.

On Wed, Mar 9, 2011 at 9:41 PM, AA <aa at serendip.demon.co.uk> wrote:

> I experimented exhaustively with this just recently; it simply doesn't work
> when I have files stored on my OS's native filesystem.  And I MUST
> apologise, because I didn't get around to filing a bug report.  (Sorry!)
>
> First of all, there's no method forURIReturnSingleMimeTypeOrDefault:, which
> is called by MIMEDocument class >> guessTypeFromName: url, which is in turn
> called when trying to determine the file MIME type.
>
> I did my downloads like this (note: 'aFile' is a MultiByteFileStream:):
>
>        html anchor
>                callback: [ self downloadFile: aFile ];
>                with: aFile localName.
>
> downloadFile: aFile
>        self requestContext respond: [ :response |
>                response
>                        contentType: (MIMEType
> forFileNameReturnSingleMimeTypeOrDefault: aFile localName);
>                        attachmentWithFileName: aFile fullName;
>                        headerAt: 'X-Accel-Redirect'
>                        put: aFile name ]
>
> I'm using nginx as my webserver, so the 'X-Accel-Redirect' is the
> equivalent for the standard 'X-SendFile' header.
>
> Now, this worked nicely in the past, but since I've upgraded to the latest
> Seaside 3.0.4, I'm having some problems...  So right now I'm debugging to
> find out what's going on (could be a misconfigured webserver, of course).
>
> Amir
>
>
>
> On Wed, 9 Mar 2011 11:25:59 -0500
> John McKeon <p3anoman at gmail.com> wrote:
>
> > Ricardo,
> >
> >  You can use WAAnchorTag>>#document:mimeType:fileName: to render a
> download
> > link.
> > Have a look at the code for
> WAUploadFunctionalTest>>#renderDownloadLinksOn:
> > to see how it is used.
> > (If you look at the test in the browser, you will have to upload a file
> > first before you will see the download links rendered)
> >
> > Hope this helps
> > John
> _______________________________________________
> seaside mailing list
> seaside at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/seaside/attachments/20110310/bdde1de5/attachment.htm


More information about the seaside mailing list