Actually, it's worse...I forgot $base_path (which makes a difference if you're drupal root is a subdirectory)... so it's $fn = $_SERVER['DOCUMENT_ROOT'] . $base_path . $file_document_path() . '/myfilename';