PEAR Manual
Prev |  | Next

# Net_FTP::cd()

Net_FTP::cd() -- changes the directory on the server.

## Synopsis

    require_once 'Net/FTP.php';

``mixed Net_FTP::cd` (string $directory)`

## Description

Changes the directory on the FTP server you are logged in. The parameter can either be an absolute path (e.g. '/home/mydir') or a relative one (e.g. 'mydir').

## Parameter

- `string $directory` - The directory you want to change to. This can either be an absolute path (e.g. '/home/mydir') or a relative one (e.g. 'mydir').

## Return value

`mixed` - true on success, otherwise PEAR::Error.

## Throws

The returned PEAR_Error object in case of an error is unspecific. You can ignore the errornumber and errormessage, because only "Directory change failed" will be returned if the operation fails.

## Note

This function can not be called statically.

## Example

Example 48-1. Using cd()
    <?php

        $test->cd('../mydir');

    ?>

Prev | Home | Next
Net_FTP::login() | Up | Net_FTP::pwd()