Help with header function
| From: | Shane Kelly | Date: | Mon, 10 Jun 2002 19:03:40 +0000 |
| Subject: | Help with header function | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-101427@lists.php.net to get a copy of this message | ||
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