]> source.dussan.org Git - nextcloud-server.git/commitdiff
send downloadfile piece by piece. saves RAM and is better suited for large files.
authorArthur Schiwon <blizzz@owncloud.com>
Tue, 1 May 2012 18:32:13 +0000 (20:32 +0200)
committerArthur Schiwon <blizzz@owncloud.com>
Wed, 2 May 2012 09:02:13 +0000 (11:02 +0200)
lib/files.php

index a7b83149574fd6a2f594c556802a1a0b7fd8aaff..107605fc34e4c45787c7e1296695fbe99734c621 100644 (file)
@@ -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);