Passing the actual path in File Save Data I have the following line in my script, but it fails to save the file in site/default/files folder. Is it possible I can replace public://feedproducts.xml with an actual absolute path to the files directory?

$file = file_save_data($sxe-&gt;asXML(),"public://feedproducts.xml",FILE_EXISTS_REPLACE);


This script runs from the command line, and is inside a sub-directory inside the root. It also loads Drupal Bootstrap.
The issue was that the script was running from a subdirectory. Calling chdir(DRUPAL_ROOT) before file_save_data() fixed it.