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); Link to comment https://forums.phpfreaks.com/topic/81343-fwrite-help/ 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'; Link to comment https://forums.phpfreaks.com/topic/81343-fwrite-help/#findComment-412832 Share on other sites More sharing options...
sureshp Posted December 12, 2007 Share Posted December 12, 2007 Or just use $myFile = "logs/log.txt"; Link to comment https://forums.phpfreaks.com/topic/81343-fwrite-help/#findComment-412952 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.