I'm using a session controlled script to allow users to get files from my server that are outside the web-readable area of the site. The problem lately has been that the files are never finishing. The browser says it's all done, but the files aren't complete. I'm on a shared host (Arvixe) and this is a new problem. They allegedly have extended the php timeout limit to an hour, but that hasn't helped.
Here's the code that does the work:
header("Content-length: $filesize");
header("Cache-control: private"); //use this to open files directly
while( !feof ( $filetoget ) ) {
$buff = fread ( $filetoget, 1024 );
ob_clean();
flush();
echo $buff;
}
fclose ($filetoget);
From a similar thread here I added these two lines, but that doesn't seem to have helped at all either:
ob_clean();
flush();