note 35222 added to function.ftp-fput

From: Date: Sun, 24 Aug 2003 02:10:43 +0000
Subject: note 35222 added to function.ftp-fput
Groups: php.notes 
Request: Send a blank email to php-notes+get-54980@lists.php.net to get a copy of this message
FTP upload server 2 server <?php $FTP_HOST ="ftp.br.geocities.com"; $FTP_USER ="bobfrank"; $FTP_PW ="mypasswd"; $FTP_ROOT_DIR="/"; $LOCAL_SERVER_DIR = "images/"; $FTP_DIR = "mydir/"; $handle=opendir($LOCAL_SERVER_DIR); while (($file = readdir($handle))!==false) { if(!is_dir($file)){ $f[]="$file"; } } closedir($handle); sort($f); $count=0; $mode = FTP_BINARY; // or FTP_ASCII $conn_id = ftp_connect($FTP_HOST); if(ftp_login($conn_id, $FTP_USER, $FTP_PW)){ print "from: ".$LOCAL_SERVER_DIR."<br>"; print "to: ".$FTP_HOST.$FTP_ROOT_DIR.$FTP_DIR."<br>"; ftp_pwd($conn_id); ftp_mkdir($conn_id,$FTP_DIR); ftp_chdir($conn_id,$FTP_DIR); foreach($f as $files) { $from = fopen($LOCAL_SERVER_DIR.$files,"r"); if(ftp_fput($conn_id, $files, $from, $mode)){ $count +=1; print $files."<br>"; } } ftp_quit($conn_id); } print "upload : $count files."; ?> ---- Manual Page -- http://www.php.net/manual/en/function.ftp-fput.php Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+35222 Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+35222&report=yes Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+35222&report=yes

« previous php.notes (#54980) next »