Actions

API15

JFTP/pwd

From Joomla! Documentation

< API15:JFTP
Revision as of 16:13, 22 March 2010 by Doxiki (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Replacement filing cabinet.png
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 retrieve the current working directory on the FTP server

[Edit Descripton]

Description:JFTP/pwd

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;
        }
 
        // Initialize 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] SeeAlso:JFTP/pwd

Examples

<CodeExamplesForm />