cry of war Posted December 12, 2007 Share Posted December 12, 2007 I have a file I call My brain (Logs stuff so i can review it at a later time) but in this file i have a fwrite function and I was wondering is there a way i can store the files it makes into a different folder so it doesnt cluder my php file area for example C:\apache2triad\htdocs\php\logger.php is where the php file is located C:\apache2triad\htdocs\php\logs\log.txt is where i would like the txt file to be C:\apache2triad\htdocs\php\log.txt but this is where it is ATM if (!isset($UserID)){ $UserID="0"; } $Date=date('D, d M Y H:i:s T'); $IP=$_SERVER['REMOTE_ADDR']; $Domain =$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']; $myFile = "log.txt"; $queryinfo = fopen($myFile, 'a') or die("can't open file"); $stringData = "Date:=>\"".$Date ."\"\nInvalid Input:=>\"".$nameofvar."\"=>\"".$value."\"\n\\\\\\\\\\Domain:=>\"".$Domain ."\"\n\\\\\\\\\\UserID:=>\"".$UserID ."\"\n\\\\\\\\\\IP:=>\"".$IP ."\"\n\n"; fwrite($queryinfo, $stringData); fclose($queryinfo); Quote Link to comment Share on other sites More sharing options...
trq Posted December 12, 2007 Share Posted December 12, 2007 $myFile = 'C:\apache2triad\htdocs\php\logs\log.txt'; Quote Link to comment Share on other sites More sharing options...
sureshp Posted December 12, 2007 Share Posted December 12, 2007 Or just use $myFile = "logs/log.txt"; Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.