0 Replies Latest reply on May 6, 2012 4:16 PM by Flex FTP Project

    How do I use FileReference.load() when selecting multiple files???

    Flex FTP Project

      Hi All,


      Basically I am developing my own Adobe Air FTP client application (Flex builder 4.6). I have have successfully managed to get the user to select one or more files from their local machine to send via FTP. The file(s) are then added to an arrayCollection which populates a data grid.


      I then have an upload button that when pressed I need to loop through each file that has previously been selected and pick up the file name, size and data stored within the file. I know I can use the FileReference class and the load() method to load the file and access the data via the .data method but the data variable is always null meaning i am obviously not using the load() method in the relevant place in the code.

      Can anyone help me get around this probblem please??


      Below are my snippets of code that I think you will need:

      When the Browse button is selected it fires the selectHandler function below to add files to the data grid:

      private function selectHandler(event:Event):void {

          fileList = fileReferenceList.fileList;

          for (var i:Number=0; i<fileList.length; i++) {

                var file:FileReference = FileReference(fileList[i]);

                arrayCollection.addItem({name:file.name, size:file.size, object:file})



          uploadTest.enabled = true;



      When i click the upload button i need to loop through all of the selected files which I am doing using a for each loop:

      private function uploadFile(event:MouseEvent):void {
               //Loops through each array element
          for each( var obj:Object in arrayCollection ) {
                //Need to get file details in here - PLEASE HELP??