Can I set headers to download a file from a remote location, eg CloudFiles

1.2k Views Asked by At

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?

2

There are 2 best solutions below

3
On

No, you would just do a 302 redirect.

0
On

No.

As Matthew suggested is to use redirect.

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