PHP ftp_rename()Functions
Complete PHP FTP Reference Manual
Definition and Usage
The ftp_rename() function renames a file or directory on the FTP server.
If successful, the function returns TRUE. If it fails, it returns FALSE.
Syntax
ftp_rename(ftp_connection,from,to)
| Parameters | Description |
|---|---|
| ftp_connection | Required. Specifies the FTP connection to use. |
| from | Required. Specifies the file or directory to rename. |
| to | Required. Specifies the new name for the file or directory. |
Examples
<?php
$conn = ftp_connect("ftp.testftp.com") or die("Could not connect");
ftp_login($conn,"admin","ert456");
ftp_rename($conn,"oldname.txt","newname.txt");
ftp_close($conn);
?>
$conn = ftp_connect("ftp.testftp.com") or die("Could not connect");
ftp_login($conn,"admin","ert456");
ftp_rename($conn,"oldname.txt","newname.txt");
ftp_close($conn);
?>
Complete PHP FTP Reference Manual Other Extensions