rpjd Posted March 31, 2011 Share Posted March 31, 2011 I'm using a php $_POST variable as the name of a file that I want to create. fopen() , according to my understanding open the file if it exists or creates it if it doesn't. $Ref = $_POST['Ref']; I using each reference element of $Ref as the name of a file in a certain directory. So if $Ref[$i] exists as a file name in a certain directory, append to the file, if it doesn't create the file in that directory and write to it. Do I use the file path of the file within fopen()? fopen(./References/$Ref,a) or fopen(./References/$Ref,w)? Quote Link to comment Share on other sites More sharing options...
sunfighter Posted March 31, 2011 Share Posted March 31, 2011 Yes, use the file path of the file within fopen(), BUT use the append mode. The w will over write an existing file, the a will add to it or if it creates it just write to it.. ref = http://us3.php.net/manual/en/function.fopen.php 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.