diff options
author | Andrey Andreev <narf@devilix.net> | 2017-01-06 12:53:53 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-01-06 12:53:53 +0100 |
commit | f9ed7c8a81ce0b8ba863bf5f72afeccf388cd655 (patch) | |
tree | c2e55ba6c580cc2a30938ffc84bde90b0a50f043 /system/helpers/download_helper.php | |
parent | ed25e2ac9d79a860736c5440cbd41043c9bc38a7 (diff) | |
parent | 826b6196b748c2c1ccca0dbb5703fd50c600afa5 (diff) |
Merge pull request #4825 from gxgpet/develop
Download helper improvement on reading phase
Diffstat (limited to 'system/helpers/download_helper.php')
-rw-r--r-- | system/helpers/download_helper.php | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/system/helpers/download_helper.php b/system/helpers/download_helper.php index b9a0e6be9..ea3da1bf4 100644 --- a/system/helpers/download_helper.php +++ b/system/helpers/download_helper.php @@ -145,11 +145,6 @@ if ( ! function_exists('force_download')) $filename = implode('.', $x); } - if ($data === NULL && ($fp = @fopen($filepath, 'rb')) === FALSE) - { - return; - } - // Clean output buffer if (ob_get_level() !== 0 && @ob_end_clean() === FALSE) { @@ -170,13 +165,12 @@ if ( ! function_exists('force_download')) exit($data); } - // Flush 1MB chunks of data - while ( ! feof($fp) && ($data = fread($fp, 1048576)) !== FALSE) + // Flush the file + if (@readfile($filepath) === FALSE) { - echo $data; + return; } - fclose($fp); exit; } } |