Check out the w and w+ modes you can pass to your fopen() call. They both truncate the file before writing data. http://www.php.net/manual/en/function.fopen.php Dave -----Original Message----- From: Tom Dell'Aringa [mailto:pixelmech at yahoo.com] Sent: Monday, December 30, 2002 3:15 PM To: thelist at lists.evolt.org Subject: [thelist] clear a text file using php? I have a text file on my server that I am writing some data to. I want to completly clear out the text file BEFORE I write to it (erase whatever is there). Is there a way to do this? I'm using php.