public
|
#
__construct( array $options = array() )
JClientFtp object constructor
JClientFtp object constructor
Parameters
- $options
array - $options Associative array of options to set
Since
12.1
|
public
|
#
__destruct( )
JClientFtp object destructor
JClientFtp object destructor
Closes an existing connection, if we have one
Since
12.1
|
public static
JClientFtp
|
#
getInstance( string $host = '127.0.0.1', string $port = '21', array $options = array(), string $user = null, string $pass = null )
Returns the global FTP connector object, only creating it if it doesn't
already exist.
Returns the global FTP connector object, only creating it if it doesn't
already exist.
You may optionally specify a username and password in the parameters. If you
do so, you may not login() again with different credentials using the same
object. If you do not use this option, you must quit() the current connection
when you are done, to free it for use by others.
Parameters
- $host
string - $host Host to connect to
- $port
string - $port Port to connect to
- $options
array - $options Array with any of these options:
type=>[FTP_AUTOASCII|FTP_ASCII|FTP_BINARY], timeout=>(int)
- $user
string - $user Username to use for a connection
- $pass
string - $pass Password to use for a connection
Returns
Since
12.1
|
public
boolean
|
#
setOptions( array $options )
Set client options
Parameters
- $options
array - $options Associative array of options to set
Returns
boolean - True if successful
Since
12.1
|
public
boolean
|
#
connect( string $host = '127.0.0.1', string $port = 21 )
Method to connect to a FTP server
Method to connect to a FTP server
Parameters
- $host
string - $host Host to connect to [Default: 127.0.0.1]
- $port
string - $port Port to connect on [Default: port 21]
Returns
boolean - True if successful
Since
12.1
|
public
boolean
|
#
isConnected( )
Method to determine if the object is connected to an FTP server
Method to determine if the object is connected to an FTP server
Returns
boolean - True if connected
Since
12.1
|
public
boolean
|
#
login( string $user = 'anonymous', string $pass = 'jftp@joomla.org' )
Method to login to a server once connected
Method to login to a server once connected
Parameters
- $user
string - $user Username to login to the server
- $pass
string - $pass Password to login to the server
Returns
boolean - True if successful
Since
12.1
|
public
boolean
|
#
quit( )
Method to quit and close the connection
Method to quit and close the connection
Returns
boolean - True if successful
Since
12.1
|
public
string
|
#
pwd( )
Method to retrieve the current working directory on the FTP server
Method to retrieve the current working directory on the FTP server
Returns
string - Current working directory
Since
12.1
|
public
string
|
#
syst( )
Method to system string from the FTP server
Method to system string from the FTP server
Returns
string - System identifier string
Since
12.1
|
public
boolean
|
#
chdir( string $path )
Method to change the current working directory on the FTP server
Method to change the current working directory on the FTP server
Parameters
- $path
string - $path Path to change into on the server
Returns
boolean - True if successful
Since
12.1
|
public
boolean
|
#
reinit( )
Method to reinitialise the server, ie. need to login again
Method to reinitialise the server, ie. need to login again
NOTE: This command not available on all servers
Returns
boolean - True if successful
Since
12.1
|
public
boolean
|
#
rename( string $from, string $to )
Method to rename a file/folder on the FTP server
Method to rename a file/folder on the FTP server
Parameters
- $from
string - $from Path to change file/folder from
- $to
string - $to Path to change file/folder to
Returns
boolean - True if successful
Since
12.1
|
public
boolean
|
#
chmod( string $path, mixed $mode )
Method to change mode for a path on the FTP server
Method to change mode for a path on the FTP server
Parameters
- $path
string - $path Path to change mode on
- $mode
mixed - $mode Octal value to change mode to, e.g. '0777', 0777 or 511 (string or
integer)
Returns
boolean - True if successful
Since
12.1
|
public
boolean
|
#
delete( string $path )
Method to delete a path [file/folder] on the FTP server
Method to delete a path [file/folder] on the FTP server
Parameters
- $path
string - $path Path to delete
Returns
boolean - True if successful
Since
12.1
|
public
boolean
|
#
mkdir( string $path )
Method to create a directory on the FTP server
Method to create a directory on the FTP server
Parameters
- $path
string - $path Directory to create
Returns
boolean - True if successful
Since
12.1
|
public
boolean
|
#
restart( integer $point )
Method to restart data transfer at a given byte
Method to restart data transfer at a given byte
Parameters
- $point
integer - $point Byte to restart transfer at
Returns
boolean - True if successful
Since
12.1
|
public
boolean
|
#
create( string $path )
Method to create an empty file on the FTP server
Method to create an empty file on the FTP server
Parameters
- $path
string - $path Path local file to store on the FTP server
Returns
boolean - True if successful
Since
12.1
|
public
boolean
|
#
read( string $remote, string & $buffer )
Method to read a file from the FTP server's contents into a buffer
Method to read a file from the FTP server's contents into a buffer
Parameters
- $remote
string - $remote Path to remote file to read on the FTP server
- $buffer
string - &$buffer Buffer variable to read file contents into
Returns
boolean - True if successful
Since
12.1
|
public
boolean
|
#
get( string $local, string $remote )
Method to get a file from the FTP server and save it to a local file
Method to get a file from the FTP server and save it to a local file
Parameters
- $local
string - $local Local path to save remote file to
- $remote
string - $remote Path to remote file to get on the FTP server
Returns
boolean - True if successful
Since
12.1
|
public
boolean
|
#
store( string $local, string $remote = null )
Method to store a file to the FTP server
Method to store a file to the FTP server
Parameters
- $local
string - $local Path to local file to store on the FTP server
- $remote
string - $remote FTP path to file to create
Returns
boolean - True if successful
Since
12.1
|
public
boolean
|
#
write( string $remote, string $buffer )
Method to write a string to the FTP server
Method to write a string to the FTP server
Parameters
- $remote
string - $remote FTP path to file to write to
- $buffer
string - $buffer Contents to write to the FTP server
Returns
boolean - True if successful
Since
12.1
|
public
boolean
|
#
append( string $remote, string $buffer )
Method to append a string to the FTP server
Method to append a string to the FTP server
Parameters
- $remote
string - $remote FTP path to file to append to
- $buffer
string - $buffer Contents to append to the FTP server
Returns
boolean - True if successful
Since
3.6.0
|
public
mixed
|
#
size( string $remote )
Get the size of the remote file.
Get the size of the remote file.
Parameters
- $remote
string - $remote FTP path to file whose size to get
Returns
mixed - number of bytes or false on error
Since
3.6.0
|
public
string
|
#
listNames( string $path = null )
Method to list the filenames of the contents of a directory on the FTP
server
Method to list the filenames of the contents of a directory on the FTP
server
Note: Some servers also return folder names. However, to be sure to list
folders on all servers, you should use listDetails() instead if you also need to
deal with folders
Parameters
- $path
string - $path Path local file to store on the FTP server
Returns
string - Directory listing
Since
12.1
|
public
mixed
|
#
listDetails( string $path = null, string $type = 'all' )
Method to list the contents of a directory on the FTP server
Method to list the contents of a directory on the FTP server
Parameters
- $path
string - $path Path to the local file to be stored on the FTP server
- $type
string - $type Return type [raw|all|folders|files]
Returns
mixed - If $type is raw: string Directory listing, otherwise array of string with
file-names
Since
12.1
|
protected
boolean
|
#
_putCmd( string $cmd, mixed $expectedResponse )
Send command to the FTP server and validate an expected response code
Send command to the FTP server and validate an expected response code
Parameters
- $cmd
string - $cmd Command to send to the FTP server
- $expectedResponse
mixed - $expectedResponse Integer response code or array of integer response codes
Returns
boolean - True if command executed successfully
Since
12.1
|
protected
boolean
|
#
_verifyResponse( mixed $expected )
Verify the response code from the server and log response if flag is set
Verify the response code from the server and log response if flag is set
Parameters
- $expected
mixed - $expected Integer response code or array of integer response codes
Returns
boolean - True if response code from the server is expected
Since
12.1
|
protected
boolean
|
#
_passive( )
Set server to passive mode and open a data port connection
Set server to passive mode and open a data port connection
Returns
boolean - True if successful
Since
12.1
|
protected
integer
|
#
_findMode( string $fileName )
Method to find out the correct transfer mode for a specific file
Method to find out the correct transfer mode for a specific file
Parameters
- $fileName
string - $fileName Name of the file
Returns
integer - Transfer-mode for this filetype [FTP_ASCII|FTP_BINARY]
Since
12.1
|
protected
boolean
|
#
_mode( integer $mode )
Set transfer mode
Parameters
- $mode
integer - $mode Integer representation of data transfer mode [1:Binary|0:Ascii] Defined
constants can also be used [FTP_BINARY|FTP_ASCII]
Returns
boolean - True if successful
Since
12.1
|