Client download of large files using readfile()
Posted: Mon Apr 17, 2006 4:12 pm
feyd | Please use
I know the above script works, because we use it all over the place for serving smaller files (about 100mb and smaller). The problem is with these larger files. They start to download fine, the client machine gets the full filesize, and the download begins. then, 9 times out of 10, the file only downloads 8-10mb, and the download cancels automatically. Its not the client machines as we have tested on every browser known and the same exact behavior exists.
In short - am i missing a config entry somewhere that i need to enable? Is this definately a PHP issue? Can anyone help?
~Jake
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
First off... I dont know if this is a PHP problem or an Apache Problem... But here is the situation, and I'm hoping that someone can at least narrow it down.
We have a machine here that hosts some processed videos. These files are LARGE, most are 1gb, with a max of about 2gb. What i have is a small site which basically lists the files from the directories, and when you click a link, a PHP script serves the file, below is the php script:Code: Select all
<?php
header("Pragma: public"); // required
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: private",false); // required for certain browsers
header("Content-Type: video/mov");
header("Content-Disposition: attachment; filename=".basename($file).";");
header("Content-Transfer-Encoding: binary");
header("Content-Length: " . filesize($file_path));
readfile("$file_path");
?>In short - am i missing a config entry somewhere that i need to enable? Is this definately a PHP issue? Can anyone help?
~Jake
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]