Questo semplicissimo script forza il download di un file.

 
< ?
if (ini_get(‘zlib.output_compression’)) {
ini_set(‘zlib.output_compression’, ‘Off’);
}
 
$ctype="application/force-download";
 
header("Pragma: public"); // required
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: private",false); // required for certain browsers
header("Content-Type: $ctype");
header("Content-Disposition: attachment; filename=\"".basename($filename)."\";" );
header("Content-Transfer-Encoding: binary");
header("Content-Length: ".filesize($filename));
readfile("$filename");
exit;
?>
 

fonte: www.sastgroup.com