Home firefox Force Download in PHP

Force Download in PHP

This script works in all browsers, including Internet Explorer! :)

if (strstr($_SERVER[‘HTTP_USER_AGENT’],"MSIE")) {
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-download");
header("Content-Disposition: attachment; filename=\"".basename($filename)."\";");
header("Content-Transfer-Encoding: binary");
header("Content-Length: ".@filesize($ab_file));
} else {
header("Content-type: application-download");
header("Content-Length: ".filesize($ab_file));
header("Content-Disposition attachment; filename=".$filename);
 Share on Facebook Share on Twitter Share on Reddit Share on LinkedIn
No Comments  comments 

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

© Copyright © 2012 · Web Development London UK · All rights reserved · Site hosted on the network
By using the site and/or making use of any of our services you agree to our Terms and Conditions