Table of Contents

write

API Package Subpackage Class Method Reference Last reviewed Doc status
API Home Package Joomla.Framework Subpackage Client Class JFTP Method write Reference write() Never Work in Progress

This method writes the contents of a buffer to a file on the FTP server. This method returns true if successful, false otherwise.

Syntax

boolean write ( $remote, $buffer, $mode )

$remote string is a string containing the remote path of the file to write to.
$buffer string is a string containing the contents to write to the specified file.
$mode integer is an integer specifying the file transfer mode. This can be one of three constants: FTP_AUTOASCII, FTP_BINARY or FTP_ASCII. These constants are defined in this class.

Examples

Example

jimport( 'joomla.connector.ftp' );

$ftp = new JFTP( array( 'type' => FTP_BINARY ) );
$ftp->connect( '127.0.0.1' );
$ftp->login( 'testuser', 'testpass' );

$buffer = "Joomla! and away!  The best selling CMS in its class!";

if ($ftp->write( 'testing/joomla.txt', $buffer ) ) {
    echo "File written successfully!";
} else {
    echo "File could not be written!";
}

might produce:

Result

File written successfully!