The issue has been reported on all operating systems and browsers, but I have never witnessed it myself, just gotten the feedback from users/testers. Here is the code used to stream the file, can anyone see a reason why I would be having issues?
Code: Select all
// Stream file
$handle = fopen( dc_file_location() . $release->filename, 'rb' );
$chunksize = 1*(1024*1024);
$buffer = '';
$cnt =0;
if ($handle === false) {
return false;
}
while (!feof($handle)) {
$buffer = fread($handle, $chunksize);
echo $buffer;
ob_flush();
flush();
if ($retbytes) {
$cnt += strlen($buffer);
}
}
$status = fclose($handle);
if ($retbytes && $status) {
return $cnt; // return num. bytes delivered like readfile() does.
}
return $status;