header('Expires: 0'); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header( 'Content-disposition: attatchment; filename='.$filename."\n"); header( 'Content-type: '.$filemime."\n"); header( 'Content-length: '.filesize($fileloc)."\n\n"); header("Content-transfer-encoding: binary"); header("Accept-Ranges: bytes"); $handle = fopen($fileloc, 'r') or die( "Can't open file."); flush(); $speed=1024; while (!feof($handle)) { print(fread($handle, $speed)); set_time_limit(0); flush(); } fclose($handle);