[Seaside] Making a download page
ricardo.jacas at gmail.com
Thu Mar 10 12:26:05 UTC 2011
im still stuck :/ , the download works but the result is an empty file
with the right name.. i give my code below:
respond: [ :response |
contentType: (MIMEType forFileNameReturnSingleMimeTypeOrDefault:
attachmentWithFileName: file fileName ]
where file is an url
2011/3/10 Avi Shefi <avishefi at gmail.com>:
> 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.
> 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 |
>> 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).
>> 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
> seaside mailing list
> seaside at lists.squeakfoundation.org
lets reign all together
More information about the seaside