2 Replies Latest reply on Mar 12, 2009 10:45 PM by gaurav_ch

    FTP using AIR anf FLASH

      Hello,
      I am trying to add some ftp functionality to my AIR app I created using Flash. Does anyone know how to do this? Please do not tell me to use FlexFTP. I can not get that to work in Flash.

      Rich
        • 1. Re: FTP using AIR anf FLASH
          Joe ... Ward Level 4
          You would have to use the Socket class to communicate with the FTP server.

          Neither AIR nor Flash have built-in APIs for conducting FTP transactions, but there could be a 3rd-party ActionScript library available.
          • 2. Re: FTP using AIR anf FLASH
            gaurav_ch Level 1
            HI,

            I am also looking for it but I was able to do so in my AIR+Javascript application. Try the following:

            var s = new air.Socket("your domain", 21);
            s.addEventListener(air.ProgressEvent.SOCKET_DATA, sOk);
            s.addEventListener(air.Event.CONNECT, sData);
            function sOk(){
            var d = s.readUTFBytes(s.bytesAvailable);
            window.alert(d);
            }
            function sData(){
            s.writeUTFBytes("USER user name\n");
            s.writeUTFBytes("PASS password\n");
            s.writeUTFBytes("CWD /\n");// set the path
            s.writeUTFBytes("TYPE A\n");// setting the type of the transfer
            s.writeUTFBytes("PASV\n");
            s.writeUTFBytes("NOOP\n");
            s.writeUTFBytes("QUIT\n");
            s.flush();
            }

            Please note that it is written in javascript and you have to port it to actionscript. But it works for me.

            Hope it helped.

            Gaurav
            www.gauravchandra.com