<?php $file = @ fopen($file_dir . $file_name,"r"); $filesize=filesize($file_dir.$file_name); header('Content-Description:File Transfer'); header("Content-Type:application/octet-stream"); header('Content-Transfer-Encoding:binary'); header("Accept-Ranges: bytes"); header('Expires:0'); header('Cache-Control:must-revalidate'); header('Pragma:public'); header("Content-Length:".$filesize); header("Content-Disposition:attachment;filename=".$file_name); ob_start(); fseek($file,0); while (!feof($file)) { set_time_limit(0); print (fread($file, 1024 * 8)); ob_flush(); flush(); } fclose($file);