-
Notifications
You must be signed in to change notification settings - Fork 0
CI_FTP
FTP Class
- Class name: CI_FTP
- Namespace:
public string $hostname = ''
FTP Server hostname
- Visibility: public
public string $username = ''
FTP Username
- Visibility: public
public string $password = ''
FTP Password
- Visibility: public
public integer $port = 21
FTP Server port
- Visibility: public
public boolean $passive = TRUE
Passive mode flag
- Visibility: public
public boolean $debug = FALSE
Debug flag
Specifies whether to display error messages.
- Visibility: public
protected resource $conn_id
Connection ID
- Visibility: protected
void CI_FTP::__construct(array $config)
Constructor
- Visibility: public
- $config array
void CI_FTP::initialize(array $config)
Initialize preferences
- Visibility: public
- $config array
boolean CI_FTP::connect(array $config)
FTP Connect
- Visibility: public
- $config array - <p>Connection values</p>
boolean CI_FTP::_login()
FTP Login
- Visibility: protected
boolean CI_FTP::_is_conn()
Validates the connection ID
- Visibility: protected
boolean CI_FTP::changedir(string $path, boolean $suppress_debug)
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.
- Visibility: public
- $path string
- $suppress_debug boolean
boolean CI_FTP::mkdir(string $path, integer $permissions)
Create a directory
- Visibility: public
- $path string
- $permissions integer
boolean CI_FTP::upload(string $locpath, string $rempath, string $mode, integer $permissions)
Upload a file to the server
- Visibility: public
- $locpath string
- $rempath string
- $mode string
- $permissions integer
boolean CI_FTP::download(string $rempath, string $locpath, string $mode)
Download a file from a remote server to the local server
- Visibility: public
- $rempath string
- $locpath string
- $mode string
boolean CI_FTP::rename(string $old_file, string $new_file, boolean $move)
Rename (or move) a file
- Visibility: public
- $old_file string
- $new_file string
- $move boolean
boolean CI_FTP::move(string $old_file, string $new_file)
Move a file
- Visibility: public
- $old_file string
- $new_file string
boolean CI_FTP::delete_file(string $filepath)
Rename (or move) a file
- Visibility: public
- $filepath string
boolean CI_FTP::delete_dir(string $filepath)
Delete a folder and recursively delete everything (including sub-folders) contained within it.
- Visibility: public
- $filepath string
boolean CI_FTP::chmod(string $path, integer $perm)
Set file permissions
- Visibility: public
- $path string - <p>File path</p>
- $perm integer - <p>Permissions</p>
array CI_FTP::list_files(string $path)
FTP List files in the specified directory
- Visibility: public
- $path string
boolean CI_FTP::mirror(string $locpath, string $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.
- Visibility: public
- $locpath string - <p>Path to source with trailing slash</p>
- $rempath string - <p>Path to destination - include the base folder with trailing slash</p>
string CI_FTP::_getext(string $filename)
Extract the file extension
- Visibility: protected
- $filename string
string CI_FTP::_settype(string $ext)
Set the upload type
- Visibility: protected
- $ext string - <p>Filename extension</p>
boolean CI_FTP::close()
Close the connection
- Visibility: public
void CI_FTP::_error(string $line)
Display error message
- Visibility: protected
- $line string