header("Content-Type: application/force-download", false); header("Content-Type: application/octet-stream", false); header("Content-Type: application/download", false); header("Content-Transfer-Encoding: binary"); header("Content-type : ". $type, false); header("Cache-control: private"); header("Content-length: " . $length); // get the browser name $browser = $_SERVER['HTTP_USER_AGENT']; // echo "setting header Content-Disposition: attachment; filename=".$file."\n\n"; // due to a bug in IE6 we can't use this - if (preg_match('/MSIE 5.5/', $browser) || preg_match('/MSIE 6.0/', $browser)) { header('Content-Disposition: filename="'.$filename.'"'); } else { header('Content-Disposition: attachment; filename="'.$filename.'"'); }