Folder Permissions

My php knowledge is slim, but I’m trying to output XML from Flash(AS3) and write it to a file via a very simple php script. I can see from my browser’s activity panel that the XML is connecting to the script and it is running, but the file is not being written so it seems like a permissions problem. I have the permissions for the enclosing folder and the folder being written to as 777. The server is running php v5.04. Here’s the script:

<?php
$filename = “xml/out.xml”;
$raw_xml = file_get_contents(“php://input”);

print $raw_xml;

$fp = fopen($filename, “w”);
fwrite($fp, $raw_xml);
fclose($fp);
?>

Thanks for any help.