note 100592 deleted from function.ftp-nlist by danbrown

From: Date: Mon, 25 Oct 2010 19:53:34 +0000
Subject: note 100592 deleted from function.ftp-nlist by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-173449@lists.php.net to get a copy of this message
Note Submitter: rogerioluizjr at gmail dot com ---- public function treeFtp($start = '/'){ $ftp = connFtp(); $files = array(); if(ftp_is_dir($ftp, $start)){ ftp_chdir($ftp, $start); $arquivos = ftp_nlist($ftp, ''); foreach($arquivos as $arquivo){ $filePath = $start . '/' . $arquivo; if(ftp_is_dir($ftp, $arquivo)){ $files = array_merge($files, treeFtp($filePath)); }else{ array_push($files, $filePath); } } }else{ $files = false; } return $files; } function ftp_is_dir($ftp, $path) { if(ftp_size($ftp, $path) == '-1'){ return true; // Is directory }else{ return false; // Is file } } function connFtp(){ $host = "255.255.255.0"; $user = "xxx"; $senha = "xxxx"; $conn = ftp_connect($host) or die("Couldn't connect to $host"); ftp_login($conn, $user, $senha); ftp_pasv($conn,true); if(!$conn){ return false; }else{ return $conn; } }

« previous php.notes (#173449) next »