Adding a patch by Zhao Lei for downloading large archives. Still commented, will be tested later.

This commit is contained in:
Lars Jung 2013-07-14 02:00:32 +02:00
parent 19eea2b316
commit b648c45929

View file

@ -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);
// }
}