Flash向php脚本发送2个变量,其中1个为xml

So this is probably a simple question, but for some reason, I'm having problems with it. I have no ideia why, but I suspect the fact that sending a xml with full "< something >" tags may cause the php to behave wrongly.

So all I need is to send (from a swf as3 client) a filename and a xml. The php will write a xml file with the required filename.

Everything should be okay with the php side, because I tried it using " $_GET " variables, but whenever I try using the flash client, It just doesent work, and the php log says that "the filename variable can't be empty". Whenever I try some static filename (not using GET or POST), it works.

Sooo... Can someone help me out with this one? Thanks.

EDIT: Code added.

var xmlURLReq:URLRequest = new URLRequest("www.url.com");
    var test:URLVariables = new URLVariables;
    test.filename = "01.xml";
    test.xmldata = xmltosave;
    xmlURLReq.data = teste;
    xmlURLReq.contentType = "text/xml";
    xmlURLReq.method = URLRequestMethod.POST;

    var xmlSendLoad:URLLoader = new URLLoader();
    xmlSendLoad.addEventListener(Event.COMPLETE, onComplete, false, 0, true);
    xmlSendLoad.addEventListener(IOErrorEvent.IO_ERROR, onIOError, false, 0, true);
    xmlSendLoad.load(xmlURLReq);

    var alertBox:alertBoxClass = new alertBoxClass();
    alertBox.x = 0;
    alertBox.y = 200;

    function onComplete(evt:Event):void 
    { 
        try 
        {
            var xmlResponse = new XML(evt.target.data);
            alertBox.alertText.text = "Inserção de dados bem sucedida!";
            addChild(alertBox);
            removeEventListener(Event.COMPLETE, onComplete);
            removeEventListener(IOErrorEvent.IO_ERROR, onIOError);
            writeXML()
        }
    }

I also tried Object and LoadVars classes instead of URLVariables, no luck so far.

EDIT: Might as well add the php code as well.

<?php
    $filename = "http://url.com/".$_POST["filename"];
    $xml = $_POST["xmldata"];
    $file = fopen($filename , "wb");
    fwrite($file, $xml);
    fclose($file);
?>

I see one possible problem in your code; You are setting the data to a URLVariables instance, but the contentType to "text/xml". It should be "application/x-www-form-urlencoded" when using URLVariables.

http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/URLRequest.html#contentType

Hope that solves it!