after upgrading to Firefox 7, I can’t download files I output via PHP on my sites.
An example:
Let’s say I have link http://example.com/download/1 returning pretty normal 800KB .ZIP file, with:
header("Content-Type: application/octet-stream");
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: public");
header("Content-Disposition: attachment; filename=" .trim($filename). "");
header("Content-Transfer-Encoding: binary");
header("Content-Length: " .filesize($filePath). ")");
readfile($filePath);
flush();
Every possible browser, even older versions of Firefox, start downloading the file as usually. Firefox 7 throws “Corrupted Content Error”.
Does anyone notice similiar behaviour? Any possible solutions?
You have a superfluous
)in thecontent-lengthfield. That may screw up the file size that the browser expects from the download, and cause the error.