From b648c4592908341785171683913b474965e9dc97 Mon Sep 17 00:00:00 2001 From: Lars Jung Date: Sun, 14 Jul 2013 02:00:32 +0200 Subject: [PATCH] Adding a patch by Zhao Lei for downloading large archives. Still commented, will be tested later. --- src/_h5ai/server/php/inc/Api.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/_h5ai/server/php/inc/Api.php b/src/_h5ai/server/php/inc/Api.php index 34e12eaf..6f7c8c08 100644 --- a/src/_h5ai/server/php/inc/Api.php +++ b/src/_h5ai/server/php/inc/Api.php @@ -135,7 +135,22 @@ class Api { header("Content-Disposition: attachment; filename=\"$as\""); header("Connection: close"); register_shutdown_function("delete_tempfile", $target); + readfile($target); + + // Patch by Zhao Lei + // Max size of download file is limited by memory_limit(default: 128M) + // in php.ini if we use readfile(). + // To solve this problem, we can change to send data with small segments. + // if ($fd = fopen($target, 'rb')) { + // set_time_limit(0); + // while (!feof($fd)) { + // print fread($fd, 1024 * 64); + // ob_flush(); + // flush(); + // } + // fclose($fd); + // } }