note 62508 added to function.file-exists

From: Date: Thu, 02 Mar 2006 06:33:58 +0000
Subject: note 62508 added to function.file-exists
Groups: php.notes 
Request: Send a blank email to php-notes+get-104674@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/function.file-exists.php Edit -- http://master.php.net/note/edit/62508 Del: integrated -- http://master.php.net/note/delete/62508/integrated Del: useless -- http://master.php.net/note/delete/62508/useless Del: bad code -- http://master.php.net/note/delete/62508/bad+code Del: spam -- http://master.php.net/note/delete/62508/spam Del: non-english -- http://master.php.net/note/delete/62508/non-english Del: in docs -- http://master.php.net/note/delete/62508/in+docs Del: other reasons-- http://master.php.net/note/delete/62508 Reject -- http://master.php.net/note/reject/62508 Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#104674) next »