Back to Joomla project (class list)

Class FtpClient - list of methods

FTP client class
Package: Joomla\CMS\Client
Copyright: (C) 2005 Open Source Matters, Inc.
License: GNU General Public License version 2 or later; see LICENSE.txt
Located at: Joomla/Client/FtpClient.php
Project: Joomla

Method Summary

public
(array $options = array())

FtpClient object constructor
Parameters
  • array $options Associative array of options to set
Since
  • 1.5
Show source code of this method: __construct Source Code

public
()

FtpClient object destructor
Since
  • 1.5
Show source code of this method: __destruct Source Code

public static \Joomla\CMS\Client\FtpClient
(mixed $host = '127.0.0.1', mixed $port = '21', array $options = array(), mixed $user = null, mixed $pass = null)

Returns the global FTP connector object, only creating it if it doesn't already exist.
Parameters
  • 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
Returns
  • \Joomla\CMS\Client\FtpClient The FTP Client object.
Since
  • 1.5
Show source code of this method: getInstance Source Code

public bool
(array $options)

Set client options
Parameters
  • array $options Associative array of options to set
Returns
  • bool True if successful
Since
  • 1.5
Show source code of this method: setOptions Source Code

public bool
(mixed $host = '127.0.0.1', mixed $port = 21)

Method to connect to a FTP server
Parameters
  • string $host Host to connect to [Default: 127.0.0.1]
  • int $port Port to connect on [Default: port 21]
Returns
  • bool True if successful
Since
  • 3.0.0
Show source code of this method: connect Source Code

public bool
()

Method to determine if the object is connected to an FTP server
Returns
  • bool True if connected
Since
  • 1.5
Show source code of this method: isConnected Source Code

public bool
(mixed $user = 'anonymous', mixed $pass = 'jftp@joomla.org')

Method to login to a server once connected
Parameters
  • string $user Username to login to the server
  • string $pass Password to login to the server
Returns
  • bool True if successful
Since
  • 1.5
Show source code of this method: login Source Code

public bool
()

Method to quit and close the connection
Returns
  • bool True if successful
Since
  • 1.5
Show source code of this method: quit Source Code

public string
()

Method to retrieve the current working directory on the FTP server
Returns
  • string Current working directory
Since
  • 1.5
Show source code of this method: pwd Source Code

public string
()

Method to system string from the FTP server
Returns
  • string System identifier string
Since
  • 1.5
Show source code of this method: syst Source Code

public bool
(mixed $path)

Method to change the current working directory on the FTP server
Parameters
  • string $path Path to change into on the server
Returns
  • bool True if successful
Since
  • 1.5
Show source code of this method: chdir Source Code

public bool
()

Method to reinitialise the server, ie. need to login again
Returns
  • bool True if successful
Since
  • 1.5
Show source code of this method: reinit Source Code

public bool
(mixed $from, mixed $to)

Method to rename a file/folder on the FTP server
Parameters
  • string $from Path to change file/folder from
  • string $to Path to change file/folder to
Returns
  • bool True if successful
Since
  • 1.5
Show source code of this method: rename Source Code

public bool
(mixed $path, mixed $mode)

Method to change mode for a path on the FTP server
Parameters
  • string $path Path to change mode on
  • mixed $mode Octal value to change mode to, e.g. '0777', 0777 or 511 (string or integer)
Returns
  • bool True if successful
Since
  • 1.5
Show source code of this method: chmod Source Code

public bool
(mixed $path)

Method to delete a path [file/folder] on the FTP server
Parameters
  • string $path Path to delete
Returns
  • bool True if successful
Since
  • 1.5
Show source code of this method: delete Source Code

public bool
(mixed $path)

Method to create a directory on the FTP server
Parameters
  • string $path Directory to create
Returns
  • bool True if successful
Since
  • 1.5
Show source code of this method: mkdir Source Code

public bool
(mixed $point)

Method to restart data transfer at a given byte
Parameters
  • int $point Byte to restart transfer at
Returns
  • bool True if successful
Since
  • 1.5
Show source code of this method: restart Source Code

public bool
(mixed $path)

Method to create an empty file on the FTP server
Parameters
  • string $path Path local file to store on the FTP server
Returns
  • bool True if successful
Since
  • 1.5
Show source code of this method: create Source Code

public bool
(mixed $remote, mixed &$buffer)

Method to read a file from the FTP server's contents into a buffer
Parameters
  • string $remote Path to remote file to read on the FTP server
  • string & $buffer Buffer variable to read file contents into
Returns
  • bool True if successful
Since
  • 1.5
Show source code of this method: read Source Code

public bool
(mixed $local, mixed $remote)

Method to get a file from the FTP server and save it to a local file
Parameters
  • string $local Local path to save remote file to
  • string $remote Path to remote file to get on the FTP server
Returns
  • bool True if successful
Since
  • 1.5
Show source code of this method: get Source Code

public bool
(mixed $local, mixed $remote = null)

Method to store a file to the FTP server
Parameters
  • string $local Path to local file to store on the FTP server
  • string $remote FTP path to file to create
Returns
  • bool True if successful
Since
  • 1.5
Show source code of this method: store Source Code

public bool
(mixed $remote, mixed $buffer)

Method to write a string to the FTP server
Parameters
  • string $remote FTP path to file to write to
  • string $buffer Contents to write to the FTP server
Returns
  • bool True if successful
Since
  • 1.5
Show source code of this method: write Source Code

public bool
(mixed $remote, mixed $buffer)

Method to append a string to the FTP server
Parameters
  • string $remote FTP path to file to append to
  • string $buffer Contents to append to the FTP server
Returns
  • bool True if successful
Since
  • 3.6.0
Show source code of this method: append Source Code

public mixed
(mixed $remote)

Get the size of the remote file.
Parameters
  • string $remote FTP path to file whose size to get
Returns
  • mixed number of bytes or false on error
Since
  • 3.6.0
Show source code of this method: size Source Code

public string
(mixed $path = null)

Method to list the filenames of the contents of a directory on the FTP server
Parameters
  • string $path Path local file to store on the FTP server
Returns
  • string Directory listing
Since
  • 1.5
Show source code of this method: listNames Source Code

public mixed
(mixed $path = null, mixed $type = 'all')

Method to list the contents of a directory on the FTP server
Parameters
  • string $path Path to the local file to be stored on the FTP server
  • 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
  • 1.5
Show source code of this method: listDetails Source Code

protected bool
(mixed $cmd, mixed $expectedResponse)

Send command to the FTP server and validate an expected response code
Parameters
  • string $cmd Command to send to the FTP server
  • mixed $expectedResponse Integer response code or array of integer response codes
Returns
  • bool True if command executed successfully
Since
  • 1.5
Show source code of this method: _putCmd Source Code

protected bool
(mixed $expected)

Verify the response code from the server and log response if flag is set
Parameters
  • mixed $expected Integer response code or array of integer response codes
Returns
  • bool True if response code from the server is expected
Since
  • 1.5
Show source code of this method: _verifyResponse Source Code

protected bool
()

Set server to passive mode and open a data port connection
Returns
  • bool True if successful
Since
  • 1.5
Show source code of this method: _passive Source Code

protected int
(mixed $fileName)

Method to find out the correct transfer mode for a specific file
Parameters
  • string $fileName Name of the file
Returns
  • int Transfer-mode for this filetype [FTP_ASCII|FTP_BINARY]
Since
  • 1.5
Show source code of this method: _findMode Source Code

protected bool
(mixed $mode)

Set transfer mode
Parameters
  • int $mode Integer representation of data transfer mode [1:Binary|0:Ascii] Defined constants can also be used [FTP_BINARY|FTP_ASCII]
Returns
  • bool True if successful
Since
  • 1.5
Show source code of this method: _mode Source Code

Properties Summary

protected resource
$_conn
Since
  • 1.5
protected resource
$_dataconn
Since
  • 1.5
protected array
$_pasv
Since
  • 1.5
protected string
$_response
Since
  • 1.5
protected int
$_timeout
Since
  • 1.5
protected int
$_type
Since
  • 1.5
protected array
$_autoAscii
Since
  • 1.5
protected array
$_lineEndings
Array to hold native line ending characters
Since
  • 1.5
protected static array
$instances
Since
  • 2.5

Tags Summary

Since
1.5