RE: [PHP-WIN] Existing File...

From: Date: Tue, 11 Dec 2001 23:10:54 +0000
Subject: RE: [PHP-WIN] Existing File...
References: 1  Groups: php.windows 
Request: Send a blank email to php-windows+get-10846@lists.php.net to get a copy of this message
You need to escape the back slashes like this: $filename="C:\\My Documents\\Linda\\mydata1.txt"; > -----Original Message----- > From: Anthony Ritter [mailto:tony@gonefishingguideservice.com] > Sent: Wednesday, 12 December 2001 12:22 p.m. > To: php-windows@lists.php.net > 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: php-windows-unsubscribe@lists.php.net > For additional commands, e-mail: php-windows-help@lists.php.net > To contact the list administrators, e-mail: > php-list-admin@lists.php.net >

« previous php.windows (#10846) next »