Fw: [PHP] Help with header function

From: Date: Mon, 10 Jun 2002 19:24:53 +0000
Subject: Fw: [PHP] Help with header function
Groups: php.general 
Request: Send a blank email to php-general+get-101429@lists.php.net to get a copy of this message
What kind of an error are you recieving? Could it be you're sending output prior to the header function? The alternative solution would be to include("file_exists.php"); then exit. -Kevin ----- Original Message ----- From: "Shane Kelly" <kellydigital@hotmail.com> To: <php-general@lists.php.net> Sent: Monday, June 10, 2002 1:03 PM Subject: [PHP] Help with header function > I'm creating an upload form for users to upload files to my server. but I > don't want them to overwrite existing files if they try to upload using the > same file name... > > THE FOLLOWING SCRIPT WORKS PERFECTLY.... > > if (file_exists("uploads/documents/".$file_name)==TRUE) { > die ("File already exists"); > } > else { > copy($file,"uploads/documents/".$file_name); } > > BUT I WOULD RATHER HAVE IT REDIRECT THEM TO ANOTHER PAGE USING.... > > if (file_exists("uploads/documents/".$file_name)==TRUE) { > > header("Location:http://www.mysite.com/file_exists.php"); > } > else { > copy($file,"uploads/documents/".$file_name); } > > THIS SCRIPT DOESN'T WORK...DOES ANYONE KNOW WHY??? > > Thanks > > Shane > kellydigital@hotmail.com > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >

« previous php.general (#101429) next »