fopen($file,"w")
where $file (and not 'file') is a variable
containing the file name ;
it is supposed to work as you say,
so may be the problem is somewhere else;
Rights/ownership on filesystem for instance;
but we need to know what do you mean when
you say "this doesn't seem to work" ?
Have you got an error message ?