summaryrefslogtreecommitdiffstats
path: root/system/helpers
diff options
context:
space:
mode:
authorGeorge Petculescu <gxgpet@gmail.com>2016-09-28 23:26:46 +0200
committerGeorge Petculescu <gxgpet@gmail.com>2016-09-28 23:26:46 +0200
commitbdf21c4e4cae0c232661f783c2f7070a03a7a912 (patch)
tree608758c4edb10f3d99d46dc92a40bec33262ca6c /system/helpers
parente36664c07896a9a9ef69daad5dc9f880ea08e5c4 (diff)
- reverting changes, wrong branch selected.
Diffstat (limited to 'system/helpers')
-rw-r--r--system/helpers/download_helper.php16
1 files changed, 11 insertions, 5 deletions
diff --git a/system/helpers/download_helper.php b/system/helpers/download_helper.php
index 3701e0b8b..a6463dfd7 100644
--- a/system/helpers/download_helper.php
+++ b/system/helpers/download_helper.php
@@ -121,6 +121,11 @@ 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)
{
@@ -141,12 +146,13 @@ if ( ! function_exists('force_download'))
exit($data);
}
- // Flush the file
- if (@readfile($filepath) === FALSE)
- {
- return;
- }
+ // Flush 1MB chunks of data
+ while ( ! feof($fp) && ($data = fread($fp, 1048576)) !== FALSE)
+ {
+ echo $data;
+ }
+ fclose($fp);
exit;
}
}