Is it possible to force a download without using the readfile
function?
My website setup consists of my server that serves the web pages plus
a high-speed file server elsewhere on the internet that servers my
files. I'm currently using header("Location: abc.com") to redirect my
users to this other site but can't force a download.
I can get it to work using readfile() but that means the file moves
from the high-speed server through my webserver and then to the user,
which I don't want.
Here's my current setup:
header("Content-Type:application/force-download;name=\"".$path_parts["basename"]."\"");
header("Content-Disposition:attachment;filename=\"".$path_parts["basename"]."\"");
header("Content-Length: $size");
header("Content-Transfer-Encoding: binary");
header("Location: ".$path["path"]."");
The above works just fine but doesn't force the download. Changing the
header("Location: ".$path["path"]."") to readfile($path["path"])
forces the download but now the file moves through my webserver and I
don't want that.
Thanks
--Matt