note 62509 deleted from ref.ftp by nlopess

From: Date: Thu, 02 Mar 2006 09:43:02 +0000
Subject: note 62509 deleted from ref.ftp by nlopess
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-104682@lists.php.net to get a copy of this message
Note Submitter: far dot east83 at gmail dot com ---- //I'm searching for php function that check does it exist or note the file in ftp server, so I came out with this function. function connect($user,$passwd, $host) { $ftp = ftp_connect($host); if ($ftp) { if (ftp_login($ftp,$user,urldecode($passwd))) return $ftp; } } function php_ftp_see ($u, $p, $d, $f) { global $h; $ftp = connect($u, $p, $h); $list = ftp_nlist($ftp, $d); foreach ($list as $key => $name) { print $key.'->'.$name.'<br>'; if ($f == $name) $file_exist = 'yes'; } if($file_exist == 'yes') print 'So there is your file there...'; else print "I'm sorry your file doesn't exist"; //careful with single quote(') and double quote(') } $h = 'google.com'; //this is your server php_ftp_see('root', 'tongkat_ali', '/usr2/sedc/bkpi', 'fileName.ext'); //parameter sent: 1=>username, 2=>password, 3=>directory, 4=>file that want to check

« previous php.notes (#104682) next »