Class JClientFtp

Description

FTP client class

  • since: 12.1

Located in /libraries/joomla/client/ftp.php (line 53)


	
			
Direct descendents
Class Description
 class JFTP Deprecated class placeholder. You should use JClientFtp instead.
Variable Summary
 static array $instances
Method Summary
 static JClientFtp getInstance ([string $host = '127.0.0.1'], [string $port = '21'], [array $options = array()], [string $user = null], [string $pass = null])
 JClientFtp __construct ([array $options = array()])
 void __destruct ()
 boolean chdir (string $path)
 boolean chmod (string $path, mixed $mode)
 boolean connect ([string $host = '127.0.0.1'], [string $port = 21])
 boolean create (string $path)
 boolean delete (string $path)
 boolean get (string $local, string $remote)
 boolean isConnected ()
 mixed listDetails ([string $path = null], [string $type = 'all'])
 string listNames ([string $path = null])
 boolean login ([string $user = 'anonymous'], [string $pass = 'jftp@joomla.org'])
 boolean mkdir (string $path)
 string pwd ()
 boolean quit ()
 boolean read (string $remote, string &$buffer)
 boolean reinit ()
 boolean rename (string $from, string $to)
 boolean restart (integer $point)
 boolean setOptions (array $options)
 boolean store (string $local, [string $remote = null])
 string syst ()
 boolean write (string $remote, string $buffer)
 integer _findMode (string $fileName)
 boolean _mode (integer $mode)
 boolean _passive ()
 boolean _putCmd (string $cmd, mixed $expectedResponse)
 boolean _verifyResponse (mixed $expected)
Variables
static array $instances = array() (line 130)
  • var: JClientFtp instances container.
  • since: 12.1
  • access: protected
Methods
static getInstance (line 192)

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.

  • return: The FTP Client object.
  • since: 12.1
  • access: public
static JClientFtp getInstance ([string $host = '127.0.0.1'], [string $port = '21'], [array $options = array()], [string $user = null], [string $pass = null])
  • string $host: Host to connect to
  • string $port: Port to connect to
  • array $options: Array with any of these options: type=>[FTP_AUTOASCII|FTP_ASCII|FTP_BINARY], timeout=>(int)
  • string $user: Username to use for a connection
  • string $pass: Password to use for a connection
Constructor __construct (line 139)

JClientFtp object constructor

  • since: 12.1
  • access: public
JClientFtp __construct ([array $options = array()])
  • array $options: Associative array of options to set

Redefined in descendants as:
Destructor __destruct (line 165)

JClientFtp object destructor

Closes an existing connection, if we have one

  • since: 12.1
  • access: public
void __destruct ()
chdir (line 485)

Method to change the current working directory on the FTP server

  • return: True if successful
  • since: 12.1
  • access: public
boolean chdir (string $path)
  • string $path: Path to change into on the server
chmod (line 597)

Method to change mode for a path on the FTP server

  • return: True if successful
  • since: 12.1
  • access: public
boolean chmod (string $path, mixed $mode)
  • string $path: Path to change mode on
  • mixed $mode: Octal value to change mode to, e.g. '0777', 0777 or 511 (string or integer)
connect (line 252)

Method to connect to a FTP server

  • return: True if successful
  • since: 12.1
  • access: public
boolean connect ([string $host = '127.0.0.1'], [string $port = 21])
  • string $host: Host to connect to [Default: 127.0.0.1]
  • string $port: Port to connect on [Default: port 21]
create (line 752)

Method to create an empty file on the FTP server

  • return: True if successful
  • since: 12.1
  • access: public
boolean create (string $path)
  • string $path: Path local file to store on the FTP server
delete (line 646)

Method to delete a path [file/folder] on the FTP server

  • return: True if successful
  • since: 12.1
  • access: public
boolean delete (string $path)
  • string $path: Path to delete
get (line 918)

Method to get a file from the FTP server and save it to a local file

  • return: True if successful
  • since: 12.1
  • access: public
boolean get (string $local, string $remote)
  • string $local: Local path to save remote file to
  • string $remote: Path to remote file to get on the FTP server
isConnected (line 311)

Method to determine if the object is connected to an FTP server

  • return: True if connected
  • since: 12.1
  • access: public
boolean isConnected ()
listDetails (line 1312)

Method to list the contents of a directory on the FTP server

  • return: If $type is raw: string Directory listing, otherwise array of string with file-names
  • since: 12.1
  • access: public
mixed listDetails ([string $path = null], [string $type = 'all'])
  • string $path: Path to the local file to be stored on the FTP server
  • string $type: Return type [raw|all|folders|files]
listNames (line 1206)

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

  • return: Directory listing
  • since: 12.1
  • access: public
string listNames ([string $path = null])
  • string $path: Path local file to store on the FTP server
login (line 326)

Method to login to a server once connected

  • return: True if successful
  • since: 12.1
  • access: public
boolean login ([string $user = 'anonymous'], [string $pass = 'jftp@joomla.org'])
  • string $user: Username to login to the server
  • string $pass: Password to login to the server
mkdir (line 685)

Method to create a directory on the FTP server

  • return: True if successful
  • since: 12.1
  • access: public
boolean mkdir (string $path)
  • string $path: Directory to create
pwd (line 396)

Method to retrieve the current working directory on the FTP server

  • return: Current working directory
  • since: 12.1
  • access: public
string pwd ()
quit (line 372)

Method to quit and close the connection

  • return: True if successful
  • since: 12.1
  • access: public
boolean quit ()
read (line 818)

Method to read a file from the FTP server's contents into a buffer

  • return: True if successful
  • since: 12.1
  • access: public
boolean read (string $remote, string &$buffer)
  • string $remote: Path to remote file to read on the FTP server
  • string &$buffer: Buffer variable to read file contents into
reinit (line 519)

Method to reinitialise the server, ie. need to login again

NOTE: This command not available on all servers

  • return: True if successful
  • since: 12.1
  • access: public
boolean reinit ()
rename (line 554)

Method to rename a file/folder on the FTP server

  • return: True if successful
  • since: 12.1
  • access: public
boolean rename (string $from, string $to)
  • string $from: Path to change file/folder from
  • string $to: Path to change file/folder to
restart (line 718)

Method to restart data transfer at a given byte

  • return: True if successful
  • since: 12.1
  • access: public
boolean restart (integer $point)
  • integer $point: Byte to restart transfer at
setOptions (line 229)

Set client options

  • return: True if successful
  • since: 12.1
  • access: public
boolean setOptions (array $options)
  • array $options: Associative array of options to set
store (line 1002)

Method to store a file to the FTP server

  • return: True if successful
  • since: 12.1
  • access: public
boolean store (string $local, [string $remote = null])
  • string $local: Path to local file to store on the FTP server
  • string $remote: FTP path to file to create
syst (line 434)

Method to system string from the FTP server

  • return: System identifier string
  • since: 12.1
  • access: public
string syst ()
write (line 1115)

Method to write a string to the FTP server

  • return: True if successful
  • since: 12.1
  • access: public
boolean write (string $remote, string $buffer)
  • string $remote: FTP path to file to write to
  • string $buffer: Contents to write to the FTP server
_findMode (line 1705)

Method to find out the correct transfer mode for a specific file

  • return: Transfer-mode for this filetype [FTP_ASCII|FTP_BINARY]
  • since: 12.1
  • access: protected
integer _findMode (string $fileName)
  • string $fileName: Name of the file
_mode (line 1742)

Set transfer mode

  • return: True if successful
  • since: 12.1
  • access: protected
boolean _mode (integer $mode)
  • integer $mode: Integer representation of data transfer mode [1:Binary|0:Ascii] Defined constants can also be used [FTP_BINARY|FTP_ASCII]
_passive (line 1617)

Set server to passive mode and open a data port connection

  • return: True if successful
  • since: 12.1
  • access: protected
boolean _passive ()
_putCmd (line 1530)

Send command to the FTP server and validate an expected response code

  • return: True if command executed successfully
  • since: 12.1
  • access: protected
boolean _putCmd (string $cmd, mixed $expectedResponse)
  • string $cmd: Command to send to the FTP server
  • mixed $expectedResponse: Integer response code or array of integer response codes
_verifyResponse (line 1558)

Verify the response code from the server and log response if flag is set

  • return: True if response code from the server is expected
  • since: 12.1
  • access: protected
boolean _verifyResponse (mixed $expected)
  • mixed $expected: Integer response code or array of integer response codes

Documentation generated on Tue, 19 Nov 2013 15:03:56 +0100 by phpDocumentor 1.4.3