Can't pass a xml from as3 to php

So I have these two scripts that comunicate with each other to create a xml file online. The way I have it now, AS3 swf sends a few variables to a php script to write. I got the creating part, but for some reason, the php does not write a xml file. I tried changing the variable to a simple "foobar" string, and it works. But If I do a:

var temp:XML = new XML(<test></test>);

It doesen't write it. So what's up, is this normal?


function SaveXml(inputxml:XML){
    var temp:XML = <teste></teste>;
    var variables:URLVariables = new URLVariables();
    variables.xmlfile = temp;
    variables.folder = TestProperties.Username;
    var request:URLRequest = new URLRequest("savexml.php");
    request.method = URLRequestMethod.POST; = variables;

    var loader:URLLoader = new URLLoader();
    loader.dataFormat = URLLoaderDataFormat.VARIABLES;

    catch (error:Error) {
        trace("Unable to load URL");

    loader.addEventListener(Event.COMPLETE, completeHandler);

    function completeHandler(e:Event)
                //something when complete;




$xmlfile = $_POST["xmlfile"];
$folder = $_POST["folder"];
$filename = date('ymdhis').".xml";

if(! file_exists("./user/".$folder."/")){
    mkdir("./user/".$folder."/", 0777);

$handle = fopen("user/".$folder."/".$filename, 'w+');
fwrite($handle, $xmlfile );

echo "result=success";


You can't create a xml in flash like you did.

var temp:XML = <teste></teste>;

Because there is no object like in your file. What you need to do is provide a string as a parameter when instantiating the XML object.

So, you should do something like below,

var temp:XML = new XML("<teste></teste>");

Now your code can send xml to php.

Need Your Help

setcors / getcors for individual files


I tried doing setcors / getcors to a single file, but I get

How to remove strings of length 5 from a set?

java string set

I want to remove strings of length 5 from a set, but it keeps outputting the set itself.