API16

JFTP/pwd

From Joomla! Documentation

< API16:JFTP
Revision as of 17:39, 22 March 2010 by Doxiki (talk | contribs) (New page: ===Description=== Method to retrieve the current working directory on the FTP server <span class="editsection" style="font-size:76%;"> <nowiki>[</nowiki>[[Description:JFTP/pwd|Edit De...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

The "API16" namespace is an archived namespace. This page contains information for a Joomla! version which is no longer supported. It exists only as a historical reference, it will not be improved and its content may be incomplete and/or contain broken links.

Description[edit]

Method to retrieve the current working directory on the FTP server

[Edit Descripton]

Template:Description:JFTP/pwd

Syntax[edit]

pwd()


Returns[edit]

string Current working directory

Defined in[edit]

libraries/joomla/client/ftp.php

Importing[edit]

jimport( 'joomla.client.ftp' );

Source Body[edit]

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]);
}

[Edit See Also] Template:SeeAlso:JFTP/pwd

Examples[edit]

<CodeExamplesForm />