Ftp
in package
FinalYes
Table of Contents
Properties
- $error : string
- Last error
- $passive : bool
- FTP passive mode flag
- $ssl : bool
- SSL-FTP connection flag
- $system_type : string
- System type of FTP server
- $usePassiveAddress : mixed
- $_host : string
- FTP host
- $_port : int
- FTP port
- $_pwd : string
- FTP password
- $_stream : resource
- FTP stream
- $_timeout : int
- FTP timeout
- $_user : string
- FTP user
Methods
- __construct() : mixed
- Initialize connection params
- __destruct() : mixed
- Auto close connection
- cd() : bool
- Change current directory on FTP server
- chmod() : false
- Set file permissions
- close() : mixed
- Close FTP connection
- connect() : bool
- Connect to FTP server
- delete() : bool
- Delete file on FTP server
- get() : bool
- Download file from server
- getContent() : mixed
- ls() : array<string|int, mixed>
- Get list of files/directories in directory
- mkdir() : bool
- Create directory on FTP server
- put() : bool
- Upload file to server
- putContent() : mixed
- putStream() : bool
- Upload data to server
- pwd() : string
- Get current directory
- rename() : bool
- Rename file on FTP server
- rmdir() : bool
- Remove directory on FTP server
Properties
$error
Last error
public
string
$error
$passive
FTP passive mode flag
public
bool
$passive
= false
$ssl
SSL-FTP connection flag
public
bool
$ssl
= false
$system_type
System type of FTP server
public
string
$system_type
$usePassiveAddress
public
mixed
$usePassiveAddress
= true
$_host
FTP host
private
string
$_host
$_port
FTP port
private
int
$_port
= 21
$_pwd
FTP password
private
string
$_pwd
$_stream
FTP stream
private
resource
$_stream
$_timeout
FTP timeout
private
int
$_timeout
= 90
$_user
FTP user
private
string
$_user
Methods
__construct()
Initialize connection params
public
__construct([string $host = null ][, string $user = null ][, string $password = null ][, int $port = 21 ][, int $timeout = 90 ]) : mixed
Parameters
- $host : string = null
- $user : string = null
- $password : string = null
- $port : int = 21
- $timeout : int = 90
-
(seconds)
__destruct()
Auto close connection
public
__destruct() : mixed
cd()
Change current directory on FTP server
public
cd([string $directory = null ]) : bool
Parameters
- $directory : string = null
Return values
boolchmod()
Set file permissions
public
chmod([int $permissions = 0 ][, string $remote_file = null ]) : false
Parameters
- $permissions : int = 0
-
(ex: 0644)
- $remote_file : string = null
Return values
falseclose()
Close FTP connection
public
close() : mixed
connect()
Connect to FTP server
public
connect() : bool
Return values
booldelete()
Delete file on FTP server
public
delete([string $remote_file = null ]) : bool
Parameters
- $remote_file : string = null
Return values
boolget()
Download file from server
public
get([string $remote_file = null ][, string $local_file = null ][, int $mode = FTP_ASCII ]) : bool
Parameters
- $remote_file : string = null
- $local_file : string = null
- $mode : int = FTP_ASCII
Return values
boolgetContent()
public
getContent(string $remote_file) : mixed
Parameters
- $remote_file : string
ls()
Get list of files/directories in directory
public
ls([string $directory = null ]) : array<string|int, mixed>
Parameters
- $directory : string = null
Return values
array<string|int, mixed>mkdir()
Create directory on FTP server
public
mkdir([string $directory = null ]) : bool
Parameters
- $directory : string = null
Return values
boolput()
Upload file to server
public
put([null $local_file = null ][, null $remote_file = null ][, int $mode = FTP_ASCII ]) : bool
Parameters
- $local_file : null = null
- $remote_file : null = null
- $mode : int = FTP_ASCII
Return values
boolputContent()
public
putContent(string $remote_file) : mixed
Parameters
- $remote_file : string
putStream()
Upload data to server
public
putStream(resource $dataStream[, string|null $remote_file = null ][, int $mode = FTP_ASCII ]) : bool
Parameters
- $dataStream : resource
- $remote_file : string|null = null
- $mode : int = FTP_ASCII
Return values
boolpwd()
Get current directory
public
pwd() : string
Return values
stringrename()
Rename file on FTP server
public
rename([string $old_name = null ][, string $new_name = null ]) : bool
Parameters
- $old_name : string = null
- $new_name : string = null
Return values
boolrmdir()
Remove directory on FTP server
public
rmdir([string $directory = null ]) : bool
Parameters
- $directory : string = null