views:

166

answers:

2

For example, if I set some headers to download a file from my server I would do

header('Content-type: application/pdf');
header('Content-Disposition: attachment; filename="downloaded.pdf"');

And then just output the data of the file

Is it possible to set a remote url in the Content-Disposition?

Example header('Content-Disposition: attachment; filename="http://remote.location/downloaded.pdf");

Or am I just thinking about it in the wrong way?

+1  A: 

No, you would just do a 302 redirect.

Matthew Flaschen
I think the answer should read "Yes, you would just do a 302 redirect". Upvoted nonetheless.
troelskn
The OP was referring to the Content-Disposition headers ("Is it possible to set a remote url in the Content-Disposition?"). It is not possible to do a redirect using those headers.
Matthew Flaschen
how would I apply this technique to a rails app where I'm linking to a remote mp3? I have asked a question about it [here](http://stackoverflow.com/questions/3278533/how-to-set-content-disposition-for-a-file-thats-stored-at-a-remote-location)
stephenmurdoch
A: 

No.

As Matthew suggested is to use redirect.

Other option is download file from script, then just output the downloaded file.

Pavels