RE: [PHP] rename()

From: Date: Thu, 11 Sep 2003 20:44:10 +0000
Subject: RE: [PHP] rename()
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-162336@lists.php.net to get a copy of this message
Thanks John, I had actually looked that one up not to long ago...I just had a nice 'ping-pong' break (helps me think :)) and I might re-write it anyway, but I will still be using the move_uploaded_file() this time. Thanks, Eddie -----Original Message----- From: CPT John W. Holmes [mailto:holmes072000@charter.net] Sent: Thursday, September 11, 2003 3:19 PM To: Edward Peloke; Php-General@Lists. Php. Net Subject: Re: [PHP] rename() From: "Edward Peloke" <epeloke@echoman.com> > This is probably an easy question Yep.. ;) > I have an uploaded image in a temp file that I want to rename and put in > another folder. I am using rename() which works fine, the problem is, I > want to force an overwrite if the file already exists. [snip] You should use move_uploaded_file(), which will overwrite the destination file if it exists. It also has the added security that rename() does not in that it will ENSURE the file actually came from an HTTP POST operation. http://us2.php.net/manual/en/function.move-uploaded-file.php ---John Holmes...

« previous php.general (#162336) next »