the filename has to be an absolute path, i think
on apache:
fopen("/home/site/my.csv");
on win (remember to escape slashes)
fopen("c:\\\home\\\site\\\my.csv");
you can test to see if the filename exists using [man]file_exists[/man]
oh, and a quicker way of error checking - rather than doing
if (!$fp = fopen($filename, 'w')) {
print "Cannot open file ($filename)";
exit;
}
i find this easier:
$fp = fopen($filename, 'w')
or die("Cannot open file for writing");
note: die stops execution
adam