[Seaside] Making a download page
aa at serendip.demon.co.uk
Fri Mar 11 08:19:53 UTC 2011
WAFileLibrary mimetypeFor: is a better method, thanks! WAAnchorTag >> document:mimeType:fileName: doesn't seem to work with MultiByteFileStream; I get errors.
In any case, with the current code, the response headers appear to be correct, so it probably indicates a problem with nginx. Just for reference, this is what I get from 'Transcript show: response headers':
a WAHeaderFields('Content-Type'->'image/png' 'Content-Disposition'->'attachment; filename="/downloads/test.png"' 'X-Accel-Redirect'->'/downloads/test.png')
I'll keep digging, just want to verify that I'm doing things properly on the Seaside end!
On Thu, 10 Mar 2011 21:53:13 +0200
Avi Shefi <avishefi at gmail.com> wrote:
> As for the detection of mime types, why not use: WAFileLibrary mimetypeFor:
> (aFilename copyAfterLast: $.)
> The bug that MIMEDocument class>>#forURIReturnSingleMimeTypeOrDefault:
> doesn't exist is associated with Pharo, not with Seaside (the class is in a
> Pharo package named Network-MIME). You're invited to file a bug in the Pharo
> issues list: http://code.google.com/p/pharo/issues/list
> As for the MultiByteFileStream - I looked around and I *think* WAAnchorTag
> can accept a MultiByteFileStream, which is later on converted to a
> WAMimeDocument. Have you given this a try?
> In general, if you somehow managed to get a MultiByteFileStream, it means
> that you should also hold the path to that file. So why not pass this path
> to the nginx-related X-Sendfile headers?
More information about the seaside