allora ho fatto così
Codice PHP:
$ftp_server = "";
$ftp_user_name = "";
$ftp_user_pass = "";
$conn_id = ftp_connect($ftp_server);
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
ftp_pasv($conn_id, TRUE);
if ((!$conn_id) || (!$login_result)) {
echo "La connessione FTP è fallita!";
echo "Tentativo di connessione a $ftp_server per l'utente $ftp_user_name";
die;
} else {
echo "Connesso a $ftp_server, utente $ftp_user_name";
}
// upload del file
$newdir = ftp_chdir($conn_id, "/Desktop");
$filename="1.jpg"; // the name the file will have on client computer
$file_to_download="1.jpg"; // the name the file has on the server (or an FTP or HTTP request)
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Content-Type: application/octet-stream");
header( "Content-Disposition: attachment; filename=\"$filename\"");
header( "Content-Description: File Transfert");
@readfile($file_to_download);
// chiudere il flusso FTP
ftp_quit($conn_id);
però mi dava l'errore dell'header già inviato,allora ho aggiunto ob_start(); all'inizio dello script...ma non va lo stesso non mi fa scaricare nulla...dov'è l'errore?
ciao