I'm trying to make a download button on my webpage, using FTP. But when I try to do this, the downloaded file is saved onto the machine which hosts my website, and not the users PC, which I want. Isn't it possible to make it, so the file can be downloaded as normal from the FTP like in the image below?
This is the download FTP function I have right now, which downloads the file into my websites project folder..
function FTP_download($id){
ob_end_flush();
$remote_file = $id.'.log';
$local_file = $id.'.log';
$conn_id = ftp_connect($this->ftp_server);
$login_result = ftp_login($conn_id, $this->ftp_user_name, $this->ftp_user_pass);
// try to download $server_file and save to $local_file
if (ftp_get($conn_id, $local_file, $remote_file, FTP_BINARY)) {
echo "Successfully written to $local_file\n";
} else {
echo "There was a problem\n";
}
// close the connection
ftp_close($conn_id);
}