$host = 'joomla.org';
$port = 21;
$options = null;
$user = 'randomUserName';
$pass = 'thisIsDefinatlyNotThePassword';
* The JFTP::getInstance() method will connect us to the FTP server and automatically
* log us in. We could do the same with the connect() and login() methods. Also check
* out JClientHelper::getCredentials('ftp');
$ftp = JFTP::getInstance($host, $port, $options, $user, $pass);
//We are connected.
//Let's print the details of the root directory
/* Assuming we only have one "Joomla" directory, this would look like this.
 => Array
[type] => 1
[rights] => drwxr-xr-x
[user] => randomUserName
[group] => ftpusers
[size] => 4096
[date] => 03-15
[time] => 2008
[name] => Joomla
//Let's create a directory
//Let's create a file in that new directory
//Let's write the first line of our Fairy Tale into our newly created text file
$ftp->write('test/fairyTale.txt', 'Once upon a time, there was a litte Mermaid, called Arielle');
//Let's read the fairy tale out of the file, and echo it out.
$fairyTale = '';
//Let's think of a name for our fairyTale, and rename the file
//I think you got the idea =)
This example was originally contributed by User:Batch1211.