Public Member Functions | |
__construct ($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) | |
download ($rempath, $locpath, $mode= 'auto') | |
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) | |
Data Fields | |
$hostname = '' | |
$username = '' | |
$password = '' | |
$port = 21 | |
$passive = TRUE | |
$debug = FALSE | |
$conn_id = FALSE | |
__construct | ( | $config = array() ) |
Constructor - Sets Preferences
The constructor can be passed an array of config values
_error | ( | $line) |
Display error message
private
string |
_getext | ( | $filename) |
Extract the file extension
private
string |
_is_conn | ( | ) |
Validates the connection ID
private
_login | ( | ) |
_settype | ( | $ext) |
Set the upload type
private
string |
changedir | ( | $path = '' , |
|
$supress_debug = FALSE |
|||
) |
Change directory
The second parameter lets us momentarily turn off debugging so that this function can be used to test for the existence 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 parameter is only used by the "mirror" function below.
public
string | |
bool |
chmod | ( | $path, | |
$perm | |||
) |
Set file permissions
public
string | the file path |
string | the permissions |
close | ( | ) |
Close the connection
public
string | path to source |
string | path to destination |
connect | ( | $config = array() ) |
FTP Connect
public
array | the connection values |
delete_dir | ( | $filepath) |
Delete a folder and recursively delete everything (including sub-folders) containted within it.
public
string |
delete_file | ( | $filepath) |
Rename (or move) a file
public
string |
download | ( | $rempath, | |
$locpath, | |||
$mode = 'auto' |
|||
) |
Download a file from a remote server to the local server
public
string | |
string | |
string |
initialize | ( | $config = array() ) |
Initialize preferences
public
array |
list_files | ( | $path = '.' ) |
FTP List files in the specified directory
public
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 |
mkdir | ( | $path = '' , |
|
$permissions = NULL |
|||
) |
Create a directory
public
string |
move | ( | $old_file, | |
$new_file | |||
) |
Move a file
public
string | |
string |
rename | ( | $old_file, | |
$new_file, | |||
$move = FALSE |
|||
) |
Rename (or move) a file
public
string | |
string | |
bool |
upload | ( | $locpath, | |
$rempath, | |||
$mode = 'auto' , |
|||
$permissions = NULL |
|||
) |