0 Replies Latest reply on Apr 25, 2007 7:47 AM by Gil1

    Sending data to a server side script problem

    Gil1 Level 1
      I have created an application that generates a survey from an XML file.

      I have included a "save" button to save the answers (stored internally in ax XML var named responses).
      On click that button runs a function onSave() as follows:

      private function onSave():void
      var request:URLRequest = new URLRequest("saveFile.php");
      request.method = URLRequestMethod.POST;

      var variables:URLVariables = new URLVariables();
      variables.filename = "test.xml";
      variables.content = responses.toString();
      request.data = variables;

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

      loader.addEventListener(Event.COMPLETE, handleComplete);

      However, it is producing the folowing error:

      Error: Error #2101: The String passed to URLVariables.decode() must be a URL-encoded query string containing name/value pairs.
      at Error$/throwError()
      at flash.net::URLVariables/decode()
      at flash.net::URLVariables$iinit()
      at flash.net::URLLoader/flash.net:URLLoader::onComplete()

      What I am doing wrong?