For Programmers: Free Programming Magazines  


Home > Archive > PHP Language > October 2006 > ftp to ftp









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author ftp to ftp
gop

2006-10-20, 6:56 pm

Bonjour,

I have online one ftp(ftp1) and other web update on ftp (ftp2).
I need to transfert any file from ftp1 to ftp2 via php page (on serveur
ftp1).

here my code but the transfert don't work (login ftp is ok).
i dont' see what's problem.

Thanks
/ ****************************************
**/
<?

$ftp_server = 'ftp.xxxxx.com';
$ftp_user_name = 'xxxx';
$ftp_user_pass = 'xxxxx';

$source_file="\\home\\xxxx\\xxxx\\fichier\\file.rar";
$destination_file= "\\home\\xxx\\fichier\\";

// connexion
$conn_id = ftp_connect($ftp_server);

// login and pass
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);

// Vérification de la connexion
if ((!$conn_id) || (!$login_result)) {
echo "Login FTP failled!";
echo "Logon at $ftp_server with $ftp_user_name\n";
die;
} else {
echo "Logon at $ftp_server, with $ftp_user_name\n";
}

/*
// download file
$upload = ftp_get($conn_id, "$destination_file", "$source_file",
FTP_BINARY);

// Vérification de téléchargement
if (!$upload) {
echo "download Ftp failled!\n";
} else {
echo "download is ok frome $source_file onr $ftp_server en
$destination_file\n";
}

*/

// close ftp
ftp_close($conn_id);
?>
/ ****************************************
********************/


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com