I am trying to connect to my FTP server using CodeIgniter FTP Class. What I want to do is to just display a success message when the connection is successful and display an error message if an error occurs. I have found that the $this->ftp->connect() function returns 1 for successful connection. But when an error occurs it takes me to the error page instead of displaying the error message.
Here is my code:
$this->load->library('ftp');
$config['hostname'] = 'ftp.example.com';
$config['username'] = 'your-username';
$config['password'] = 'your-password';
$config['debug'] = TRUE;
if ($this->ftp->connect($config)) {
echo "success!";
} else {
echo "error!";
}
Any suggestion on how I can handle this error will be really helpful.
