I want to know how can i do from ftp_fget, ftp_nb_fget to transfert ? Because when I insert just "ok" in output, it's work but when I insert string data of PHP://temp from ftp_fget() no but the program have an issue (HTTP Error : ERR_INVALID_RESPONSE).
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename='.$filename.'.tar.gz');
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
header('Content-Length: ' . ftp_size($server, $filename)); //Remove
$tempHandle = fopen('php://temp', 'r+');
if (@ftp_fget($server, $tempHandle, $filename, FTP_ASCII, 0)) {
rewind($tempHandle);
echo stream_get_contents($tempHandle);
}