8 Replies Latest reply on May 19, 2010 12:04 PM by Matt Le Fevre

    Multiple file download

    ric_bia

      I'm using FileReference.download() to download a single file from a server to a local machine.

       

      The download() function opens a dialog box where the user select where he wants to save the file and what name give to it.

       

      Is it possible to download X files in sequence without calling X FileReference.download() and so X dialogs open?

       

      A single download() with more files?

      Multiple download() but without the dialog box?

        • 1. Re: Multiple file download
          Matt Le Fevre Level 4

          I know it's possible to upload multiple files at once using FileReferenceList, but i don't think it's possible to download multiple files at once.

           

          You could always go the route of using a script to zip up all the files selected, and then download that?

          • 2. Re: Multiple file download
            shinank

            I am trying to accomplish the same thing. Would it be possible to pass the files to a local application (java or air perhaps) that would be able to write multiple files to the users specified location?

             

            Thanks.

            • 3. Re: Multiple file download
              ric_bia Level 1

              I confirm that multiple uploading is possible using FileReferenceList because I've used that.

               

              But I can't use a script to zip up all the files and then download because the user has to find his files as is in the user-defined folder, not zipped to unzip next.

              • 4. Re: Multiple file download
                shinank Level 1

                Matt,

                Thank you for your response. But what about multiple file downloads but only a single prompt for the user to download?

                 

                Thanks.

                • 5. Re: Multiple file download
                  Matt Le Fevre Level 4

                  i doubt it, if that was possible it would provide a major security hole that could be exploited.

                   

                  I developed a FTP application in flex for a client a while back, and that's when i did most of my searching around to see if this was possible, and couldn't turn up anything apart from people saying it wasn't possible.

                   

                  I'd be very interested to hear if someone say it is, but until then i believe the only way to accomplish something like this is like a said, a server side script to handle all selected file references for download, zip them up and then allowed the user to download that zip file.

                   

                   

                  I imagine, it might be possible in AIR (considering that has far greater access to the local machine), but as far as a flex app goes, i'm pretty confident to say it's not possible.

                   

                  let me know if you find out otherwise though.

                  • 6. Re: Multiple file download
                    shinank Level 1

                    Matt,

                    Thanks again. That is pretty much what I figured but I had to ask just in case. I think you are correct about AIR. I believe it has more capability to interact with the workstation.

                     

                    If I find out any method to accomplish this I will post back here.

                    • 7. Re: Multiple file download
                      ric_bia Level 1

                      Could you please tell me how to follow the "multiple files - one zip" solution?

                      • 8. Re: Multiple file download
                        Matt Le Fevre Level 4

                        You'll need to use an external script to access the files on your server and create a zip file from them, for example PHP.

                         

                        http://davidwalsh.name/create-zip-php

                         

                        all you need to do is pass across the file locations to the PHP script, then return the location of the zip file to the flex app.

                         

                        then simply use the returned location as a source for your fileReference for downloading, ta daa