note 62509 added to ref.ftp

From: Date: Thu, 02 Mar 2006 06:35:00 +0000
Subject: note 62509 added to ref.ftp
Groups: php.notes 
Request: Send a blank email to php-notes+get-104675@lists.php.net to get a copy of this message
//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 ---- Server IP: 202.157.183.147 Probable Submitter: 219.93.201.195 (proxied: 192.168.1.217) ---- X-Spam-Status: No, hits=3.3 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER, HTML_MESSAGE autolearn=no version=2.64 ---- Manual Page -- http://www.php.net/manual/en/ref.ftp.php Edit -- http://master.php.net/note/edit/62509 Del: integrated -- http://master.php.net/note/delete/62509/integrated Del: useless -- http://master.php.net/note/delete/62509/useless Del: bad code -- http://master.php.net/note/delete/62509/bad+code Del: spam -- http://master.php.net/note/delete/62509/spam Del: non-english -- http://master.php.net/note/delete/62509/non-english Del: in docs -- http://master.php.net/note/delete/62509/in+docs Del: other reasons-- http://master.php.net/note/delete/62509 Reject -- http://master.php.net/note/reject/62509 Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#104675) next »