PHP ftp_pwd()Functions
Complete PHP FTP Reference Manual
Definition and Usage
The ftp_pwd() function returns the current directory name of the specified FTP connection.
Syntax
ftp_pwd(ftp_connection)
| Parameters | Description |
|---|---|
| ftp_connection | Required. Specifies the FTP connection to use. |
Examples
<?php
$conn = ftp_connect("ftp.testftp.com") or die("Could not connect");
ftp_login($conn,"admin","ert456");
// print current directory
echo ftp_pwd($conn) . "<br />";
// change directory to images
ftp_chdir($conn,"images");
// print current directory
echo ftp_pwd($conn);
ftp_close($conn);
?>
$conn = ftp_connect("ftp.testftp.com") or die("Could not connect");
ftp_login($conn,"admin","ert456");
// print current directory
echo ftp_pwd($conn) . "<br />";
// change directory to images
ftp_chdir($conn,"images");
// print current directory
echo ftp_pwd($conn);
ftp_close($conn);
?>
The above code will output:
/
/images
/images
Complete PHP FTP Reference Manual Other Extensions