FTP Class - Usage first time at codeigniter how to? - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=11) +--- Thread: FTP Class - Usage first time at codeigniter how to? (/showthread.php?tid=87494) |
FTP Class - Usage first time at codeigniter how to? - pinguim86 - 04-25-2023 Hi, This is my first time at php MVC. I need to use an class from system. I will be reading files from a ftp server. At tutorial of codeigniter.com web site. There is some instructions on how to use the FTP capability. <?php namespace App\Controllers; use App\Controllers\BaseController; class FtpController extends BaseController{ public function listFtp(){ $this->load->library('ftp'); $config['hostname'] = 'ftp.example.com'; $config['username'] = 'your-username'; $config['password'] = 'your-password'; $config['debug'] = TRUE; $this->ftp->connect($config); $list = $this->ftp->list_files('/public_html'); print_r($list); $this->ftp->close(); } } This is my controller called with the listFtp function. This function is described at my route.php file. When I run the controller I got an error which the codeigniter could not load the library. I am using the structure wrong? How can I use the Controller on a function way? What is the right use of this class and app controller? At my function listFtp does not work at the first line. $this->load->library('ftp'); |