3 Replies Latest reply on Sep 28, 2009 8:10 AM by kglad

    FileReference

    asdf1

      Hey, i'm trying to create a multiple file uploader using FileReference. The user should be able to select more than one file but i don't want to use FileReferenceList for this. So instead the user opens the Browse dialog, picks a file then opens up the Browse dialog again, picks another file etc.

       

      To make this work i'm trying to copy the FileReference object into an array, but this isn't really working. Here's how i do it:

       

      fileref.as

      import flash.net.FileReference;

      class fileref {
      public var fileRef:FileReference;// = new FileReference();
      }

       

      main project (which omports the fileref.as)

      var listener:Object = new Object();
      listener.onSelect = function(file:FileReference) {
      var tC:fileref = new fileref();
      tC.fileRef = file;
      arrRef.push( tC );

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

              trace("name: " + arrRef[i].fileRef.name);
          }

      }

       

      As you can see i'm trying to store the parameter 'file'  into an instance of the class 'fileref', this works the first time cause then i get this output:

       

      name: image1.jpg

       

      After i open the Browse dialog again and select a file i should get this as outpupt:

       

      name: image1.jpg

      name: image2.jpg

       

      But instead i get:

       

      name: image2

      name: image2

       

      Why is this happening?? And how can i make it so, that i can add multiple files..??