summaryrefslogtreecommitdiffstats
path: root/system/helpers
diff options
context:
space:
mode:
authorGeorge Petculescu <gxgpet@gmail.com>2016-09-30 20:34:44 +0200
committerGeorge Petculescu <gxgpet@gmail.com>2016-09-30 20:34:44 +0200
commit826b6196b748c2c1ccca0dbb5703fd50c600afa5 (patch)
treec2bab4c92b9fa54b9a7d14fb27241d876f0aa3a3 /system/helpers
parent30a66c8cb47ef785b08843b7051b2003ed907246 (diff)
- download helper uses better file buffering when the content of a local file is output'd
Diffstat (limited to 'system/helpers')
-rw-r--r--system/helpers/download_helper.php12
1 files changed, 3 insertions, 9 deletions
diff --git a/system/helpers/download_helper.php b/system/helpers/download_helper.php
index a6463dfd7..7f5c2397a 100644
--- a/system/helpers/download_helper.php
+++ b/system/helpers/download_helper.php
@@ -121,11 +121,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)
{
@@ -146,13 +141,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;
}
}