diff --git a/phpBB/download.php b/phpBB/download.php index 64d147fa79..d3f600abdb 100644 --- a/phpBB/download.php +++ b/phpBB/download.php @@ -245,8 +245,19 @@ function send_file_to_browser($attachment, $upload_dir, $category) header("Content-Length: $size"); } - // Might not be ideal to store the contents, but file_get_contents is binary-safe as well as the recommended method - echo @file_get_contents($filename); + // Try to deliver in chunks + @set_time_limit(0); + + $fp = @fopen($filename, 'rb'); + + if ($fp !== false) + { + while (!feof($fp)) + { + echo fgets($fp, 8192); + } + fclose($fp); + } flush(); exit;