API16:JFTP/pwd
From Joomla! Documentation
Description
Method to retrieve the current working directory on the FTP server
<! removed transcluded page call, red link never existed >
Syntax
pwd()
Returns
string Current working directory
Defined in
libraries/joomla/client/ftp.php
Importing
jimport( 'joomla.client.ftp' );
Source Body
function pwd() {
// If native FTP support is enabled lets use it...
if (FTP_NATIVE) {
if (($ret = @ftp_pwd($this->_conn)) === false) {
JError::raiseWarning('35', 'JFTP::pwd: Bad response');
return false;
}
return $ret;
}
// Initialise variables.
$match = array (null);
// Send print working directory command and verify success
if (!$this->_putCmd('PWD', 257)) {
JError::raiseWarning('35', 'JFTP::pwd: Bad response', 'Server response: '.$this->_response.' [Expected: 257]');
return false;
}
// Match just the path
preg_match('/"[^"\r\n]*"/', $this->_response, $match);
// Return the cleaned path
return preg_replace("/\"/", "", $match[0]);
}
<! removed transcluded page call, red link never existed >
Examples
Code Examples