[Seaside] Making a download page

AA aa at serendip.demon.co.uk
Sun Mar 20 06:57:44 UTC 2011

Hi Avi, Ricardo

I found my error!  I'd set the file download directory to be in my home directory: '/home/me/downloads'.  But, of course, this absolute path isn't recognised as a valid URL by nginx, so (duh!) that's why it wouldn't work.  After moving '/downloads' to the root directory (and changing the permissions), it works fine.

I've also found it necessary to use 'attachmentWithFileName:', otherwise the web server assumes the content-disposition to be 'inline' rather than 'attached', and displays the file instead of saving it.

Avi, thanks for all your help!  Ricardo, have you managed to get your downloads working yet?


On Sun, 13 Mar 2011 10:05:40 +0200
Avi Shefi <avishefi at gmail.com> wrote:

> 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.

More information about the seaside mailing list