Public Member Functions | |
| CI_FTP ($config=array()) | |
| initialize ($config=array()) | |
| connect ($config=array()) | |
| _login () | |
| _is_conn () | |
| changedir ($path= '', $supress_debug=FALSE) | |
| mkdir ($path= '', $permissions=NULL) | |
| upload ($locpath, $rempath, $mode= 'auto', $permissions=NULL) | |
| rename ($old_file, $new_file, $move=FALSE) | |
| move ($old_file, $new_file) | |
| delete_file ($filepath) | |
| delete_dir ($filepath) | |
| chmod ($path, $perm) | |
| list_files ($path= '.') | |
| mirror ($locpath, $rempath) | |
| _getext ($filename) | |
| _settype ($ext) | |
| close () | |
| _error ($line) | |
Public Attributes | |
| $hostname = '' | |
| $username = '' | |
| $password = '' | |
| $port = 21 | |
| $passive = TRUE | |
| $debug = FALSE | |
| $conn_id = FALSE | |
| CI_FTP::_error | ( | $ | line | ) |
Display error message
private
| string |
| CI_FTP::_getext | ( | $ | filename | ) |
Extract the file extension
private
| string |
| CI_FTP::_is_conn | ( | ) |
Validates the connection ID
private
| CI_FTP::_login | ( | ) |
FTP Login
private
| CI_FTP::_settype | ( | $ | ext | ) |
Set the upload type
private
| string |
| CI_FTP::changedir | ( | $ | path = '', |
|
| $ | supress_debug = FALSE | |||
| ) |
Change direcotry
The second parameter lets us momentarily turn off debugging so that this function can be used to test for the existance of a folder without throwing an error. There's no FTP equivalent to is_dir() so we do it by trying to change to a particular directory. Internally, this paramter is only used by the "mirror" function below.
public
| string | ||
| bool |
| CI_FTP::chmod | ( | $ | path, | |
| $ | perm | |||
| ) |
Set file permissions
public
| string | the file path | |
| string | the permissions |
| CI_FTP::CI_FTP | ( | $ | config = array() |
) |
Constructor - Sets Preferences
The constructor can be passed an array of config values
| CI_FTP::close | ( | ) |
Close the connection
public
| string | path to source | |
| string | path to destination |
| CI_FTP::connect | ( | $ | config = array() |
) |
FTP Connect
public
| array | the connection values |
| CI_FTP::delete_dir | ( | $ | filepath | ) |
Delete a folder and recursively delete everything (including sub-folders) containted within it.
public
| string |
| CI_FTP::delete_file | ( | $ | filepath | ) |
Rename (or move) a file
public
| string |
| CI_FTP::initialize | ( | $ | config = array() |
) |
Initialize preferences
public
| array |
| CI_FTP::list_files | ( | $ | path = '.' |
) |
FTP List files in the specified directory
public
| CI_FTP::mirror | ( | $ | locpath, | |
| $ | rempath | |||
| ) |
Read a directory and recreate it remotely
This function recursively reads a folder and everything it contains (including sub-folders) and creates a mirror via FTP based on it. Whatever the directory structure of the original file path will be recreated on the server.
public
| string | path to source with trailing slash | |
| string | path to destination - include the base folder with trailing slash |
| CI_FTP::mkdir | ( | $ | path = '', |
|
| $ | permissions = NULL | |||
| ) |
Create a directory
public
| string |
| CI_FTP::move | ( | $ | old_file, | |
| $ | new_file | |||
| ) |
Move a file
public
| string | ||
| string |
| CI_FTP::rename | ( | $ | old_file, | |
| $ | new_file, | |||
| $ | move = FALSE | |||
| ) |
Rename (or move) a file
public
| string | ||
| string | ||
| bool |
| CI_FTP::upload | ( | $ | locpath, | |
| $ | rempath, | |||
| $ | mode = 'auto', |
|||
| $ | permissions = NULL | |||
| ) |
Upload a file to the server
public
| string | ||
| string | ||
| string |
| CI_FTP::$conn_id = FALSE |
| CI_FTP::$debug = FALSE |
| CI_FTP::$hostname = '' |
| CI_FTP::$passive = TRUE |
| CI_FTP::$password = '' |
| CI_FTP::$port = 21 |
| CI_FTP::$username = '' |
1.5.7.1