aboutsummaryrefslogtreecommitdiffstats
path: root/lib/files.php
diff options
context:
space:
mode:
authorArthur Schiwon <blizzz@owncloud.com>2012-05-01 20:32:13 +0200
committerArthur Schiwon <blizzz@owncloud.com>2012-05-02 11:02:13 +0200
commitc9eaffd3363f06137fb197138d0b197679085537 (patch)
tree4b5e8cccc818b43b5c44bdbb9d1017aa4d26d1f6 /lib/files.php
parent8ed8d9cd91de8b4c977c1b7c0e7facba4754135e (diff)
downloadnextcloud-server-c9eaffd3363f06137fb197138d0b197679085537.tar.gz
nextcloud-server-c9eaffd3363f06137fb197138d0b197679085537.zip
send downloadfile piece by piece. saves RAM and is better suited for large files.
Diffstat (limited to 'lib/files.php')
-rw-r--r--lib/files.php9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/files.php b/lib/files.php
index a7b83149574..107605fc34e 100644
--- a/lib/files.php
+++ b/lib/files.php
@@ -119,7 +119,14 @@ class OC_Files {
}
@ob_end_clean();
if($zip){
- readfile($filename);
+ $handle=fopen($filename,'r');
+ if ($handle) {
+ $chunkSize = 8*1024;// 1 MB chunks
+ while (!feof($handle)) {
+ echo fread($handle, $chunkSize);
+ flush();
+ }
+ }
unlink($filename);
}else{
OC_Filesystem::readfile($filename);