mirror of
https://github.com/lrsjng/h5ai.git
synced 2024-09-20 12:48:55 -04:00
Adding a patch by Zhao Lei for downloading large archives. Still commented, will be tested later.
This commit is contained in:
parent
19eea2b316
commit
b648c45929
1 changed files with 15 additions and 0 deletions
|
@ -135,7 +135,22 @@ class Api {
|
||||||
header("Content-Disposition: attachment; filename=\"$as\"");
|
header("Content-Disposition: attachment; filename=\"$as\"");
|
||||||
header("Connection: close");
|
header("Connection: close");
|
||||||
register_shutdown_function("delete_tempfile", $target);
|
register_shutdown_function("delete_tempfile", $target);
|
||||||
|
|
||||||
readfile($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);
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue