You need to escape the back slashes like this: $filename="C:\\My Documents\\Linda\\mydata1.txt";
> -----Original Message----- > From: Anthony Ritter [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, 12 December 2001 12:22 p.m. > To: [EMAIL PROTECTED] > Subject: [PHP-WIN] Existing File... > > > 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> > > > > > > -- > PHP Windows Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: > [EMAIL PROTECTED] > -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]