FTP has long been established as the standard way for administrators to transfer files to their web servers. Joomla! provides us with the JFTP
class, which can be used to connect to FTP servers and perform common functions.
The main purpose of this class is to overcome problems with access rights when working with the local file system. When FTP access is enabled in the site configuration, Joomla! will attempt to use FTP instead of PHP file system functions.
Whenever we connect to an FTP server we require certain settings to be in place. If we want to use the FTP settings defined in the global configuration, we can use the JClientHelper
class to easily access these settings.
This example demonstrates how we can use JClientHelper
static getCredentials()
method to get the FTP settings:
jimport('joomla.client.helper'); $FTP_Settings = JClientHelper::getCredentials('ftp');
The JClientHelper
static getCredentials()
method returns an associative array with the following keys...