Commit fcae11a2 authored by Seblu's avatar Seblu

optimize memory consumption when downloading files

parent 327cfc77
......@@ -161,7 +161,14 @@ function getVideo() {
header('Content-Transfer-Encoding: binary;');
header('Content-Length: ' . filesize($video["video_path"]).';');
flush();
readfile($video["video_path"]);
//We now push by block of 10M to save memory consumption of readfile
//readfile($video["video_path"]);
$fd = fopen($video["video_path"], 'rb');
while (!feof($fd)) {
$buf = fread($fd, 10485760);
echo $buf;
}
fclose($fd);
}
else {
header("Status: 404 Not Found");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment