1 Reply Latest reply on Mar 12, 2009 4:20 PM by kmdguy

    How to combine FileReferenceList objects into one?

    kmdguy Level 1
      Hi there,

      I'm successfully uploading multiple files to a server using the FileReferenceList object. But if you go to browse() for more files to add to the ones you've already selected (perhaps they are in another folder), then the original FileReferenceList object is emptied and replaced with the new files that are chosen.

      What I want is the ability to create a "master" FileReferenceList that can hold the results of multiple browse() calls. I've used "concat" to combine arrays before but I can't get it to work here. Here's the idea that I'm going for:

      private var myMasterFileList:FileReferenceList;
      private var myFileList:FileReferenceList;

      var myMasterFileList = myMasterFileList.concat(myFileList)

      Then when the user is ready, they can send the myMasterFileList:FileReferenceList off to be uploaded in one batch. In other words how do I create a running master file list from each subsequent file list call.

      Thanks for your advice!
        • 1. Re: How to combine FileReferenceList objects into one?
          kmdguy Level 1
          Well, it appears as I'm reading up on this a bit, that it may be that the FileReference or FileReferenceList objects are "read-only" therefore cannot be manipulated like a typical array. This doesn't make sense to me why this would be the case because in a multi-file upload situation, there could very well be a user who choose some files from one folder, but needs to upload additional files from another folder. The process of initiating another browse() method clears out the first list. If you could manipulate the file list like a normal array then you could just continue to add items to the first file list or a new "master" file list... THEN send all those items to upload at once.

          I want this functionality and so I think I'll need to creatively create many different instances of a FileReferenceList object so a user can gather up a variety of files from different locations and send them all at once.

          If anyone has any enlightenment on this I would love to discuss it because I'm still new to Flex and may be missing something obvious.

          Thanks!