I have a php script that I have used for years to force downloads from my website. But sometime in the last month or so, it stopped working and is triggering file not found errors. The weird thing is that in firefox, if I do view source on the error page, it is the file I was trying to download. And doing File > Save from there give you the correct file. So I know it's not a problem with the script not finding the file on the server.
Is there something wrong with how I am setting up the headers?
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: private",false);
header('Content-Type: application/octet-stream');
header('Content-Transfer-Encoding: Binary');
header('Content-length: '.filesize($file_url));
header('Content-disposition: attachment; filename="'.basename($file_url).'"');
readfile($file_url);