downloads | documentation | faq | getting help | mailing lists | reporting bugs | sites | links | my 
search for in the  
view the version of this page
Last updated: Thu, 21 Aug 2003


(PHP 3>= 3.0.13, PHP 4 )

ftp_rename -- Renames a file on the FTP server


bool ftp_rename ( resource ftp_stream, string from, string to)

ftp_rename() renames the file or directory that is currently named from to the new name to, using the FTP stream ftp_stream.

Returns TRUE on success or FALSE on failure.

add a note add a note User Contributed Notes
Hugo locobyte at hotmail dot NO_SPAM dot com
23-Nov-2002 04:29
Using "ftp_rename" to move files to other directories on server ftp
if(ftp_rename($conn_ftp, $xfiles[$i], "./dirx/".$xfiles[$i])) {
       echo "File $xfiles[$i] moved to ./dirx";
} else {
       echo "ERROR!!!. The file could not be moved";
#-->>h2m,  bye
29-Sep-2000 07:59
# Simple example for ftp_rename
# Warning! Not tested...

$server = '';

$user = 'anonymous';
$pass = '';

$original_name = 'file_name.txt';
$new_name = 'new_file_name.txt';

$ftp_connect = ftp_connect ($server)
    or die ("Could not connect to $server");

$ftp = ftp_login ($ftp_connect, $user, $pass)
    or die ("Authentication failed");

$rename = ftp_rename ($ftp_connect, $original_name, $new_name);

if ($rename)
    print "$original_name renamed to $new_name.";
    print "$original_name could not be renamed...";

ftp_quit ($ftp_connect);

 Last updated: Thu, 21 Aug 2003
show source | credits | sitemap | mirror sites 
Copyright © 2001-2003 The PHP Group
All rights reserved.
This mirror generously provided by:
Last updated: Sat 01 Nov 2003 04:13:36 EST EST