Existing File...
| From: | Anthony Ritter | Date: | Tue, 11 Dec 2001 23:21:44 +0000 |
| Subject: | Existing File... | ||
| Groups: | php.windows | ||
| Request: | Send a blank email to php-windows+get-10844@lists.php.net to get a copy of this message | ||
I've got a file that already exists called:
mydata1.txt
I'm trying to test the code below so that if the file is found it will say:
File Exists
When I run the following script, it doesn't write out:
File Exists...
I get nothing on the screen.
eventhough I thought the code below would work.
Any advice would be greatly appreciated.
Tony Ritter
...........................................................
<?
$filename="C:\My Documents\Linda\mydata1.txt";
if(file_exists($filename))
{
$msg="<P>File Exists!</P>";
}
else
{
$newfile=fopen($filename, "w+")or die("Couldn't create the file!");
}
?>
<HTML>
<HEAD>
<TITLE Creating a New File </TITLE>
</HEAD>
<BODY>
<? echo "$msg"; ?>
</BODY>
</HTML>