title: Download file via PHP script from FTP server to browser with Content-Length header without storing the file on the web server
body: <p>I use this code to download a file to memory from ftp:</p>
  
  <pre><code>public static function getFtpFileContents($conn_id , $file)
  {
      ob_start();
      $result = ftp_get($conn_id, "php://output", $file, FTP_BINARY);
      $data = ob_get_contents();
      ob_end_clean();
      if ($resul)
          return $data;
      return null;
  }
  </code></pre>
  
  <p>How can I make it directly send the file to the user (browser) without saving to disk and without redirecting to the ftp server ?</p>