API16:JFTP/rename
From Joomla! Documentation
This Namespace has been archived - Please Do Not Edit or Create Pages in this namespace. Pages contain information for a Joomla! version which is no longer supported. It exists only as a historical reference, will not be improved and its content may be incomplete.
Contents |
Description
Method to rename a file/folder on the FTP server
Syntax
rename($from, $to)
| Parameter Name | Default Value | Description |
|---|---|---|
| $from | $from Path to change file/folder from | |
| $to | $to Path to change file/folder to |
Returns
boolean True if successful
Defined in
libraries/joomla/client/ftp.php
Importing
jimport( 'joomla.client.ftp' );
Source Body
function rename($from, $to) { // If native FTP support is enabled lets use it... if (FTP_NATIVE) { if (@ftp_rename($this->_conn, $from, $to) === false) { JError::raiseWarning('35', 'JFTP::rename: Bad response'); return false; } return true; } // Send rename from command to the server if (!$this->_putCmd('RNFR '.$from, 350)) { JError::raiseWarning('35', 'JFTP::rename: Bad response', 'Server response: '.$this->_response.' [Expected: 320] From path sent: '.$from); return false; } // Send rename to command to the server if (!$this->_putCmd('RNTO '.$to, 250)) { JError::raiseWarning('35', 'JFTP::rename: Bad response', 'Server response: '.$this->_response.' [Expected: 250] To path sent: '.$to); return false; } return true; }
[Edit See Also] SeeAlso:JFTP/rename
Examples
<CodeExamplesForm />
