4 Replies Latest reply on Jan 13, 2007 8:36 AM by FlightGuy

    download generic file in flex

    AtemAtem
      Hi,

      is it possible to let the user download a text file which is generated at run time?
      I don't want to send it to a server side script to save the file onto the server.

      regards,

      myatem
        • 1. Re: download generic file in flex
          FlightGuy Level 1
          I'm not sure I understand your question. By download I would normally understand transfer from the server to the client, but you say don't want it on the server. I assume you're generating something in your flex application and want to write it to the filesystem?

          If so, then no - Flash player cannot access the local filesystem. If you're just wanting to save it for later access from Flash, use the SharedObject class (see doc).

          Tim
          • 2. download generic file in flex
            AtemAtem Level 1
            right. i want to write the generated string to the filesystem (the user can select the filename).

            I've tryed to call javascript from flex that opens a new browser window which shows my generated string. But this doesn't work on my local file system. There is an "sandbox security violation". I don't want to upload my files on a server before running them each time.

            Now i have written a webservice which i want to call from my flex app to save the generated string on a server. Then i could call FileReference.download(URL) to let the user save the generated file to his local drive.

            myatem
            • 3. Re: download generic file in flex
              AtemAtem Level 1
              i can't even call a webservice when starting the app from my local file system

              Is there any flags to change this security behaviour?

              myatem
              • 4. Re: download generic file in flex
                FlightGuy Level 1
                I think that if you add a crossdomain.xml file to your server it will solve your problem. See chapter 4 of the "Building and Deploying Flex 2 Applications".

                Tim