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" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
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
> [EMAIL PROTECTED]
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php