From b799a0b3f09238fe46892b811025e7bf2ac81b19 Mon Sep 17 00:00:00 2001 From: Derek Jones Date: Tue, 6 Aug 2013 15:38:21 -0700 Subject: Partial update to FTP docs --- user_guide_src/source/libraries/ftp.rst | 87 +++++++++++++++++++-------------- 1 file changed, 49 insertions(+), 38 deletions(-) (limited to 'user_guide_src/source') diff --git a/user_guide_src/source/libraries/ftp.rst b/user_guide_src/source/libraries/ftp.rst index 05a3fdcc8..fd82590b9 100644 --- a/user_guide_src/source/libraries/ftp.rst +++ b/user_guide_src/source/libraries/ftp.rst @@ -10,9 +10,19 @@ directory to be recreated remotely via FTP. .. note:: SFTP and SSL FTP protocols are not supported, only standard FTP. -********************** +.. contents:: + :local: + +.. raw:: html + +
+ +************************** +Working with the FTP Class +************************** + Initializing the Class -********************** +====================== Like most other classes in CodeIgniter, the FTP class is initialized in your controller using the $this->load->library function:: @@ -79,53 +89,54 @@ In this example a local directory is mirrored on the server. $this->ftp->close(); -****************** -Function Reference -****************** +*************** +Class Reference +*************** -$this->ftp->connect() -===================== +.. class:: CI_FTP -Connects and logs into to the FTP server. Connection preferences are set -by passing an array to the function, or you can store them in a config -file. + .. method:: connect([$config = array()]) -Here is an example showing how you set preferences manually:: + :param array $config: Connection values + :returns: bool - $this->load->library('ftp'); + Connects and logs into to the FTP server. Connection preferences are set + by passing an array to the function, or you can store them in a config + file. - $config['hostname'] = 'ftp.example.com'; - $config['username'] = 'your-username'; - $config['password'] = 'your-password'; - $config['port'] = 21; - $config['passive'] = FALSE; - $config['debug'] = TRUE; + Here is an example showing how you set preferences manually:: - $this->ftp->connect($config); + $this->load->library('ftp'); -Setting FTP Preferences in a Config File -**************************************** + $config['hostname'] = 'ftp.example.com'; + $config['username'] = 'your-username'; + $config['password'] = 'your-password'; + $config['port'] = 21; + $config['passive'] = FALSE; + $config['debug'] = TRUE; -If you prefer you can store your FTP preferences in a config file. -Simply create a new file called the ftp.php, add the $config array in -that file. Then save the file at config/ftp.php and it will be used -automatically. + $this->ftp->connect($config); -Available connection options -**************************** + **Setting FTP Preferences in a Config File** -- **hostname** - the FTP hostname. Usually something like: - ftp.example.com -- **username** - the FTP username. -- **password** - the FTP password. -- **port** - The port number. Set to 21 by default. -- **debug** - TRUE/FALSE (boolean). Whether to enable debugging to - display error messages. -- **passive** - TRUE/FALSE (boolean). Whether to use passive mode. - Passive is set automatically by default. + If you prefer you can store your FTP preferences in a config file. + Simply create a new file called the ftp.php, add the $config array in + that file. Then save the file at config/ftp.php and it will be used + automatically. + + **Available connection options** + + ================== =================================== + Option Name Description + ================== =================================== + **hostname** the FTP hostname. Usually something like: ftp.example.com + **username** the FTP username + **password** the FTP password + **port** The port number. Set to 21 by default. + **debug** TRUE/FALSE (boolean). Whether to enable debugging to display error messages. + **passive** TRUE/FALSE (boolean). Whether to use passive mode. Passive is set automatically by default. + ================== =================================== -$this->ftp->upload() -==================== Uploads a file to your server. You must supply the local path and the remote path, and you can optionally set the mode and permissions. -- cgit v1.2.3-24-g4f1b