I am working on a simple project which is some how related to download a big file (80MB), while hiding the actual physical location of file from the user, I am doing this by writing a simple php file, which takes ID of file as argument and then from database picks the name of file and then simply write the file to input stream of client browser.. All the things are working fine but problem is that while downloading the big file, if user wants to open some other link of my website it doesn't work untill the download is complete.... Or He/She opens another browser window and start surffing from there....which is unacceptable for me.... It seems that server and client are working on single thread model which is obviously not true.. here is the code snippet of my download.php file..
Code: Select all
<?php
$fSize = filesize("myvideos/videos/testvideo.flv");
header('Content-transfer-encoding: binary');
header('Content-Type: video/x-flv');
header('Content-Length: '.$fSize);
header('Content-Disposition: attachment; '.'filename='testvideo.flv'");
header ("Pragma: public");
header ("Expires: 0");
header ("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header ("Cache-Control: private");
ob_clean();
ob_end_flush();
readfile("myvideos/videos/testvideo.flv"); /*Write file to out put stream*/
?>
Regards
Bye
Ummar