Hi, How can I add the date to this file (day / month / year)? $fc = fopen($dirname."Testname - $filename", "wb"); Thankx
This assumes that by Day/Month/Year, you mean 26/04/2008. $dirname needs to be set to the DIR in relation to where this script is running $filename is (obviously) the filename to append the date to. <?php $dirname = "testdir"; $filename = "testfile.txt"; $file = fopen($dirname.$filename, "a"); if(!file_exists($dirname.$filename)) { die("<font color=\"red\"><b>Error:</b> Could not open file: " . $dirname.$filename . "</font>"); } $write = fwrite($file, date("d/m/Y")); if(!$write) { die("<font color=\"red\"><b>Error:</b> Could not write to file: " . $dirname.$filename . "</font>"); } fclose($file); ?> PHP: