I'm using a simple fopen("w")
and fwrite
setup to write a new file on my server. Recently, this has been arbitrarily assigning 0640 permissions to these files, which means I can't view them from a browser. But it's not happening every time. Can anybody tell me why? What I'm missing here? Here's my code:
if ($file=fopen("$filesDir/$yr/$mo/{$tempFile[0]}.xml","wb")) {
if(fwrite($file,$output,strlen($output))) {
$success="YES";
$message="File successfully built.";
} else {
$message="Could not write XML file.";
}
} else {
$message="Could not open file.";
}