Commit fcae11a2 authored by Seblu's avatar Seblu
Browse files

optimize memory consumption when downloading files

parent 327cfc77
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -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");