1 Reply Latest reply on Feb 4, 2010 10:50 AM by Gregory Lafrance

    Saving data to a file on server

    RosieGp

      Hi,

      I have a html editor where the user can input data. Then i have a save button and text input box for them to enter a filename. What I need to do is when they hit save it automatically saves data in a file, named by used then add .html at the end and then save it to a folder on a server...

      I know that I have to define path and save it on server

      Something like this:

      private

       

       

       

       

       

      function saveFile():void

      {

       

      var url:String = '

      \\\\thisserver\\thisfolder\\' + filenamefromuser + '.html';

       

      var

      ;

       

      var

      var urlReq:URLRequest = new URLRequest( url );

      navigateToURL( urlReq,

      '_blank' );

      }

       

      But not exactly sure how to do it.. Any help is appreciate...

       

       

      <mx:Form

       

       

      width="100%">

       

       

      <mx:TextArea width="100%">

       

       

      <mx:HBox>

       

       

      <mx:Button label="Save"

       

      icon="

      @Embed(source='/assets/edit.png')"

      click="saveFile()"

      id="

      btnSave"/>

       

       

      <mx:Label text="Enter the File Name Here: "

      textAlign="

      center"

       

      height="35"/>

       

       

      <mx:TextInput id="fileName"

      width="

      200"/>

       

       

      </mx:HBox>

       

      </mx:Form>

       

        • 1. Re: Saving data to a file on server
          Gregory Lafrance Level 6

          navigateToURL() is used to open web pages, not to save them.

           

          I think you will need to use HTTPService to call a script, such as a PHP, Perl, Python etc. script on the server to accept the data, write the file.

           

          The HTTPService could return a message stating that the save was successful, and then you could automatically use navigateToURL() to open the file just created.

           

          If this post answers your question or helps, please mark it as such.


          Greg Lafrance - Flex 2 and 3 ACE certified

          www.ChikaraDev.com

          Flex / AIR Development, Training, and Support Services