RE: [PHP] Moving Files From One Directory To Another

From: Date: Tue, 12 Nov 2002 04:54:27 +0000
Subject: RE: [PHP] Moving Files From One Directory To Another
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-123933@lists.php.net to get a copy of this message
> Which built-in PHP functions would I use to move a file from one directory > into another? I'm thinking that this requires more than one function to > achieve what I want. > > What approaches should I take? Do I need to copy the file into a temporary > directory first and then move it to the destination directory? Or Is it > possible for me to move the file directly from one directory into another? > > The functions I read about so far are copy() and move_uploaded_file(), but > the move_uploaded_file() function seems to work only when the file is > uploaded from an HTML form, or am I wrong? > > Just looking for some direction. Use copy() to copy the file and then unlink() to delete the old one if the copy is successful. Or you can use exec() to make a system call to do it. ---John Holmes...

« previous php.general (#123933) next »