note 22205 rejected from function.ftp-put by spic
| From: | spic@php.net | Date: | Wed, 18 Sep 2002 19:52:07 +0000 |
| Subject: | note 22205 rejected from function.ftp-put by spic | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-36921@lists.php.net to get a copy of this message | ||
WHY IT DOESN'T WORK!!!!!!
my path is ok, it connects, but it put "upload a echoué" (= upload failed)
WHY!!
$gallerie_image_rep = "/web/photo/";
$ftp_server = "ftp.blabla.com";
$ftp_user = "user";
$ftp_pass = "user";
$error_id=0;
$error_ftp=0;
//Connection au serveur ftp
$connection_ftp = @ftp_connect( "$ftp_server" );
$login_to_ftp = @ftp_login( $connection_ftp, $ftp_user, $ftp_pass);
if((!$connection_ftp) || (!$login_to_ftp)) ++$error_ftp;
if($error_ftp!=0)
{
print( "<tr><td>Erreur, Probleme de connection au serveur
ftp</td></tr>" );
exit;
}
//changement de dossier
if( !@ftp_chdir($connection_ftp, $gallerie_image_rep))
{
print( "<tr><td>Erreur, Probleme pour trouver le dossier de
destination</td></tr>" );
exit;
}
//upload
$nom_du_fichier = basename($photo);
$upload=@ftp_put($connection_ftp, "$nom_du_fichier", "$nom_du_fichier",
FTP_BINARY);
//verification
if(!$upload)
{
print( "<tr><td>Erreur, L'upload a échoué</td></tr>"
);
exit;
}
@ftp_quit( $connection_ftp );