2 Replies Latest reply on Oct 3, 2010 9:31 PM by ArrowUpRight

    True multiline text to a .txt file

    ArrowUpRight Level 2

      Hello everyone!

       

      Developing a Flex application.

       

      I need a multiline .txt file created by my Application & that can be used by another application (so it have to be nicely formatted).

       

      I have a .php service file that creates a file from App's parameters sended to it:

       

      <?php

      $getVar = $_POST['TheString'];

      $file = 'test.txt';

      $writeVar = fopen($file,'w');

      fwrite($writeVar,$getVar);

      fclose($writeVar);

      ?>

       

      and the collection of AS service functions to send parameters.

       

              private function sendData(str:String):void {
                  variables = new URLVariables();
                  fData = new URLRequest("fileservices/SaveService.php");
                  fData.method = URLRequestMethod.POST;
                  fData.data = variables;
                  fLoader = new URLLoader();
                  fLoader.dataFormat = URLLoaderDataFormat.VARIABLES;
                  fLoader.addEventListener(Event.COMPLETE, sendComplete);
                  variables.TheString = str;
                  fLoader.load(fData);
              }

       

      (taked from someone's example)

       

      All works, but when send a string containing '/n' paragraph character, it does not work in .txt file opened with Notepad.

       

      So, what is that specific character to use to mark paragraphs returns,

      or should i use the different class instead of String,

      or have i to edit my .php file to add such usability (and what is that magic changes to bring)?