summaryrefslogtreecommitdiffstats
path: root/system/libraries/Ftp.php
diff options
context:
space:
mode:
Diffstat (limited to 'system/libraries/Ftp.php')
-rwxr-xr-x[-rw-r--r--]system/libraries/Ftp.php50
1 files changed, 46 insertions, 4 deletions
diff --git a/system/libraries/Ftp.php b/system/libraries/Ftp.php
index 16ad9ad43..d7a8b3b02 100644..100755
--- a/system/libraries/Ftp.php
+++ b/system/libraries/Ftp.php
@@ -2,11 +2,11 @@
/**
* CodeIgniter
*
- * An open source application development framework for PHP 4.3.2 or newer
+ * An open source application development framework for PHP 5.1.6 or newer
*
* @package CodeIgniter
* @author ExpressionEngine Dev Team
- * @copyright Copyright (c) 2008 - 2010, EllisLab, Inc.
+ * @copyright Copyright (c) 2008 - 2011, EllisLab, Inc.
* @license http://codeigniter.com/user_guide/license.html
* @link http://codeigniter.com
* @since Version 1.0
@@ -40,7 +40,7 @@ class CI_FTP {
*
* The constructor can be passed an array of config values
*/
- function CI_FTP($config = array())
+ public function __construct($config = array())
{
if (count($config) > 0)
{
@@ -281,6 +281,48 @@ class CI_FTP {
// --------------------------------------------------------------------
/**
+ * Download a file from a remote server to the local server
+ *
+ * @access public
+ * @param string
+ * @param string
+ * @param string
+ * @return bool
+ */
+ function download($rempath, $locpath, $mode = 'auto')
+ {
+ if ( ! $this->_is_conn())
+ {
+ return FALSE;
+ }
+
+ // Set the mode if not specified
+ if ($mode == 'auto')
+ {
+ // Get the file extension so we can set the upload type
+ $ext = $this->_getext($rempath);
+ $mode = $this->_settype($ext);
+ }
+
+ $mode = ($mode == 'ascii') ? FTP_ASCII : FTP_BINARY;
+
+ $result = @ftp_get($this->conn_id, $locpath, $rempath, $mode);
+
+ if ($result === FALSE)
+ {
+ if ($this->debug == TRUE)
+ {
+ $this->_error('ftp_unable_to_download');
+ }
+ return FALSE;
+ }
+
+ return TRUE;
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
* Rename (or move) a file
*
* @access public
@@ -412,7 +454,7 @@ class CI_FTP {
* Set file permissions
*
* @access public
- * @param string the file path
+ * @param string the file path
* @param string the permissions
* @return bool
*/