Support Joomla!

Joomla! 1.5 Documentation

Packages

Package: Joomla-Framework

Developer Network License

The Joomla! Developer Network content is © copyright 2006 by the individual contributors and can be used in accordance with the Creative Commons License, Attribution- NonCommercial- ShareAlike 2.5

 Class JFTP

Description

FTP client class

Located in /joomla/client/ftp.php (line 61)

Class JObject   (Subpackage Base)

Class JFTP   (Subpackage Client)
Method Summary
Constructor JFTP __construct ([array $options = array()])
Destructor void __destruct ()
Method boolean chdir (string $path)
Method boolean chmod (string $path, string/int $mode)
Method boolean connect ([string $host = '127.0.0.1'], [string $port = 21])
Method boolean create (string $path)
Method boolean delete (string $path)
Method boolean get (string $local, string $remote)
Method JFTP &getInstance ([string $host = '127.0.0.1'], [string $port = '21'], [array $options = null], [string $user = null], [string $pass = null])
Method boolean isConnected ()
Method mixed listDetails ([string $path = null], [string $type = 'all'], boolean $search)
Method string listNames ([string $path = null])
Method boolean login ([string $user = 'anonymous'], [string $pass = '[email protected]'])
Method boolean mkdir (string $path)
Method string pwd ()
Method boolean quit ()
Method boolean read (string $remote,  &$buffer, string $buffer)
Method boolean reinit ()
Method boolean rename (string $from, string $to)
Method boolean restart (int $point)
Method boolean setOptions (array $options)
Method boolean store (string $local, [string $remote = null])
Method string syst ()
Method boolean write (string $remote, string $buffer)
Methods
Constructor __construct (line 144)

JFTP object constructor

  • since: 1.5
  • access: protected
JFTP __construct ([array $options = array()])
  • array $options: Associative array of options to set

Redefinition of:
JObject::__construct()
Class constructor, overridden in descendant classes.
Destructor __destruct (line 179)

JFTP object destructor

Closes an existing connection, if we have one

  • since: 1.5
  • access: protected
void __destruct ()
chdir (line 445)

Method to change the current working directory on the FTP server

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

Method to change mode for a path on the FTP server

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

Method to connect to a FTP server

  • return: True if successful
  • 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 654)

Method to create an empty file on the FTP server

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

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

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

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

  • return: True if successful
  • access: public
boolean get (string $local, string $remote)
  • string $local: Path to local file to save remote file as
  • string $remote: Path to remote file to get on the FTP server

Redefinition of:
JObject::get()
Returns a property of the object or the default value if the property is not set.
getInstance (line 205)

Returns a reference to the global FTP connector object, only creating it if it doesn't already exist.

This method must be invoked as:

  $ftp = &JFTP::getInstance($host);

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: 1.5
JFTP &getInstance ([string $host = '127.0.0.1'], [string $port = '21'], [array $options = null], [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
isConnected (line 304)

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

  • return: True if connected
  • since: 1.5
  • access: public
boolean isConnected ()
listDetails (line 1066)

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
  • access: public
mixed listDetails ([string $path = null], [string $type = 'all'], boolean $search)
  • string $path: Path local file to store on the FTP server
  • string $type: Return type [raw|all|folders|files]
  • boolean $search: Recursively search subdirectories
listNames (line 1000)

Method to list the file/folder names of the contents of a directory on the FTP server

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

Method to login to a server once connected

  • return: True if successful
  • access: public
boolean login ([string $user = 'anonymous'], [string $pass = '[email protected]'])
  • string $user: Username to login to the server
  • string $pass: Password to login to the server
mkdir (line 601)

Method to create a directory on the FTP server

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

Method to retrieve the current working directory on the FTP server

  • return: Current working directory
  • access: public
string pwd ()
quit (line 354)

Method to quit and close the connection

  • return: True if successful
  • access: public
boolean quit ()
read (line 705)

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

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

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

NOTE: This command not available on all servers

  • return: True if successful
  • access: public
boolean reinit ()
rename (line 501)

Method to rename a file/folder on the FTP server

  • return: True if successful
  • 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 627)

Method to restart data transfer at a given byte

  • return: True if successful
  • access: public
boolean restart (int $point)
  • int $point: Byte to restart transfer at
setOptions (line 236)

Set client options

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

Method to store a file to the FTP server

  • return: True if successful
  • 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 408)

Method to system string from the FTP server

  • return: System identifier string
  • access: public
string syst ()
write (line 931)

Method to write a string to the FTP server

  • return: True if successful
  • 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

Inherited Methods

Inherited From JObject

 JObject::JObject()
 JObject::__construct()
 JObject::get()
 JObject::getPublicProperties()
 JObject::set()
 JObject::toString()

Documentation generated on Mon, 05 Mar 2007 21:02:06 +0000 by phpDocumentor 1.3.1