When I try to download large size video from my PHP website, download stopped after downloading nearly 18 MB.
I am using following script to download video file.
@ignore_user_abort();
@set_time_limit(0);
ob_end_clean();
if (!is_file($str_clip_path) or connection_status()!=0) return(FALSE);
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
header("Expires: ".gmdate("D, d M Y H:i:s", mktime(date("H")+2, date("i"), date("s"), date("m"), date("d"), date("Y")))." GMT");
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
header("Content-Type: application/octet-stream");
header("Content-Length: ".(filesize($str_clip_path)));
header("Content-Disposition: attachment; filename=".$str_download_filename);
header("Content-Transfer-Encoding: binary");
header("Accept-Ranges: bytes");
if ($fp = fopen($str_clip_path, 'rb'))
{
while(!feof($fp))
{
print(fread($fp, 1*(1024*1024)));
flush();
ob_flush();
}
fclose($fp);
exit();
}
On my IIS server, following values are set for specific variables.
memory_limit 512M
max_execution_time 10800
max_input_time 10800
post_max_size 512M
upload_max_filesize 512M
Please help me to make necessary changes in above script so I can download larger video files from website.
Thank you in advance, KRA
If you using nginx web server you can use x-accel-redirect