PHP Class CI_FTP, TastyIgniter

Author: EllisLab Dev Team
Afficher le fichier Open project: tastyigniter/tastyigniter Class Usage Examples

Méthodes publiques

Свойство Type Description
$debug boolean Specifies whether to display error messages.
$hostname string FTP Server hostname
$passive boolean Passive mode flag
$password string FTP Password
$port integer FTP Server port
$username string FTP Username

Protected Properties

Свойство Type Description
$conn_id resource Connection ID

Méthodes publiques

Méthode Description
__construct ( array $config = [] ) : void Constructor
changedir ( string $path, boolean $suppress_debug = FALSE ) : boolean Change directory
chmod ( string $path, integer $perm ) : boolean Set file permissions
close ( ) : boolean Close the connection
connect ( array $config = [] ) : boolean FTP Connect
delete_dir ( string $filepath ) : boolean Delete a folder and recursively delete everything (including sub-folders) contained within it.
delete_file ( string $filepath ) : boolean Rename (or move) a file
download ( string $rempath, string $locpath, string $mode = 'auto' ) : boolean Download a file from a remote server to the local server
initialize ( array $config = [] ) : void Initialize preferences
list_files ( string $path = '.' ) : array FTP List files in the specified directory
mirror ( string $locpath, string $rempath ) : boolean Read a directory and recreate it remotely
mkdir ( string $path, integer $permissions = NULL ) : boolean Create a directory
move ( string $old_file, string $new_file ) : boolean Move a file
rename ( string $old_file, string $new_file, boolean $move = FALSE ) : boolean Rename (or move) a file
upload ( string $locpath, string $rempath, string $mode = 'auto', integer $permissions = NULL ) : boolean Upload a file to the server

Méthodes protégées

Méthode Description
_error ( string $line ) : void Display error message
_getext ( string $filename ) : string Extract the file extension
_is_conn ( ) : boolean Validates the connection ID
_login ( ) : boolean FTP Login
_settype ( string $ext ) : string Set the upload type

Method Details

__construct() public méthode

Constructor
public __construct ( array $config = [] ) : void
$config array
Résultat void

_error() protected méthode

Display error message
protected _error ( string $line ) : void
$line string
Résultat void

_getext() protected méthode

Extract the file extension
protected _getext ( string $filename ) : string
$filename string
Résultat string

_is_conn() protected méthode

Validates the connection ID
protected _is_conn ( ) : boolean
Résultat boolean

_login() protected méthode

FTP Login
protected _login ( ) : boolean
Résultat boolean

_settype() protected méthode

Set the upload type
protected _settype ( string $ext ) : string
$ext string Filename extension
Résultat string

changedir() public méthode

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 changedir ( string $path, boolean $suppress_debug = FALSE ) : boolean
$path string
$suppress_debug boolean
Résultat boolean

chmod() public méthode

Set file permissions
public chmod ( string $path, integer $perm ) : boolean
$path string File path
$perm integer Permissions
Résultat boolean

close() public méthode

Close the connection
public close ( ) : boolean
Résultat boolean

connect() public méthode

FTP Connect
public connect ( array $config = [] ) : boolean
$config array Connection values
Résultat boolean

delete_dir() public méthode

Delete a folder and recursively delete everything (including sub-folders) contained within it.
public delete_dir ( string $filepath ) : boolean
$filepath string
Résultat boolean

delete_file() public méthode

Rename (or move) a file
public delete_file ( string $filepath ) : boolean
$filepath string
Résultat boolean

download() public méthode

Download a file from a remote server to the local server
public download ( string $rempath, string $locpath, string $mode = 'auto' ) : boolean
$rempath string
$locpath string
$mode string
Résultat boolean

initialize() public méthode

Initialize preferences
public initialize ( array $config = [] ) : void
$config array
Résultat void

list_files() public méthode

FTP List files in the specified directory
public list_files ( string $path = '.' ) : array
$path string
Résultat array

mirror() public méthode

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 mirror ( string $locpath, string $rempath ) : boolean
$locpath string Path to source with trailing slash
$rempath string Path to destination - include the base folder with trailing slash
Résultat boolean

mkdir() public méthode

Create a directory
public mkdir ( string $path, integer $permissions = NULL ) : boolean
$path string
$permissions integer
Résultat boolean

move() public méthode

Move a file
public move ( string $old_file, string $new_file ) : boolean
$old_file string
$new_file string
Résultat boolean

rename() public méthode

Rename (or move) a file
public rename ( string $old_file, string $new_file, boolean $move = FALSE ) : boolean
$old_file string
$new_file string
$move boolean
Résultat boolean

upload() public méthode

Upload a file to the server
public upload ( string $locpath, string $rempath, string $mode = 'auto', integer $permissions = NULL ) : boolean
$locpath string
$rempath string
$mode string
$permissions integer
Résultat boolean

Property Details

$conn_id protected_oe property

Connection ID
protected resource $conn_id
Résultat resource

$debug public_oe property

Specifies whether to display error messages.
public bool $debug
Résultat boolean

$hostname public_oe property

FTP Server hostname
public string $hostname
Résultat string

$passive public_oe property

Passive mode flag
public bool $passive
Résultat boolean

$password public_oe property

FTP Password
public string $password
Résultat string

$port public_oe property

FTP Server port
public int $port
Résultat integer

$username public_oe property

FTP Username
public string $username
Résultat string