PHP Force Download :: Fixing Safari Download Header Issues
October 26, 2007
Problem:
We’d got this client requesting a download script written in PHP. The Script should be able to run in Mozilla Firefox, MS IE, and Safari. Sounds simple enough right? I mean this could simply be done by just sending the following headers:
—
header(“Expires: 0″);
header(“Cache-Control: must-revalidate, post-check=0, pre-check=0″);
header(“Cache-Control: private”,false);
header(“Content-Transfer-Encoding: binary”);
header(“Content-Type: video/x-ms-wmv”);
header(“Content-Length: “.@filesize($filepath));
header(“Content-Disposition: attachment; filename=\”".$filename.“\”;”);
—
We’ve been using this header to force browser to download contents since day one. We thought nothing was wrong with it. That’s before we tested it with Safari. For some reason Safari just displays a blank white page. No error messages no nothing.
Solution:
(more…)
Filed under: PHP, Safari |
Comments (2)
Related Links:
