[Seaside] Making a download page

Avi Shefi avishefi at gmail.com
Sun Mar 13 08:05:40 UTC 2011


Amir,
Your code is fine, and works OK. The only thing that's wrong is that it uses
contentType:attachementWithFileName , whereas X-Accel-Redirect doesn't
require these headers. Using these headers will confuse browsers into
thinking that you're actually trying to download a file (without X-Sendfile
redirection). This is why you get a file with 0 bytes - there's no file
contents in the transport.

You should use only contentType and X-Accel-Redirect to specify your file.


Cheers,
Avi.

On Fri, Mar 11, 2011 at 12:12 PM, AA <aa at serendip.demon.co.uk> wrote:

> Thanks for looking at the headers.  Here's the rest of my code:
>
> renderUploadOn: html
>        html form multipart; with: [
>                html fileUpload callback: [ :f | self uploadFile: f ].
>                html submitButton text: 'Load' ]
>
> uploadFile: aFile
>        file := (FileDirectory default directoryNamed: self filePath)
> assureExistence;
>                forceNewFileNamed: aFile fileName.
>        [ file binary; nextPutAll: aFile contents ]
>                ensure: [ file close ].
>        ^ file
>
>
> Amir
>
>
> On Fri, 11 Mar 2011 11:11:45 +0200
> Avi Shefi <avishefi at gmail.com> wrote:
>
> > Amir,
> > The headers look fine. I'm interested in your code, specifically from
> where
> > you get a MultiByteFileStream.
> > Could you elaborate please? maybe supply your code?
> _______________________________________________
> 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/20110313/a62d49ad/attachment-0001.htm


More information about the seaside mailing list