public function ftp_test($id = null) { $server = $this->Server->findById($id); $ftp = new \FtpClient\FtpClient(); $ftp->connect($server['Server']['host']); $ftp->login($server['Server']['username'], $server['Server']['password']); $ftp->pasv(true); $ftp->rmdir('/www/blabla', true); }
<?php $ftp = new \FtpClient\FtpClient(); $ftp->connect('host'); $ftp->login('user', 'pwd'); var_dump($ftp->scanDir('.'));
/** * Ftp Dosya Aktarımı * * @param $local string Yerel Dizin * @param $remote string Hedef Dizin * * @return array status,mesaj,detail */ public function ftp($local, $remote) { try { $ftp = new FtpClient\FtpClient(); $ftp->connect($this->host); $ftp->login($this->ftp[0], $this->ftp[1]); $this->messages(array('status' => 'info', 'mesaj' => 'File transfer started..')); $ftp->putAll($local, $remote, FTP_BINARY); } catch (\Exception $e) { return array('status' => 'failure', 'mesaj' => 'Ftp : ' . $e->getMessage()); } return array('status' => 'info', 'mesaj' => 'File transfer finished'); }