i'm not sure, but you might want to use a PATH for your text file...otherwise it could be in your /TMP directory or something. you might also check permissions...do you have permission to write the folder where you're trying to put the text file?
also, you might want to do something like
$success =fopen(blah blah);
and then if success if false, report the error.