0 Replies Latest reply on Jun 22, 2009 3:15 AM by v-Jay

    Problem with downloading file using FileReference




           I want to save a file from flex web application.

        for this  I have a servlet which takes string as request object and return same as outputstream. I have tested servlet aned it works fine.

      When i am calling this servlet from flex using FileReference.download(), it shows a dialog for saving file but when entered name and press ok, no file is saved.


        Here is flex code;

      private function downloadfile(Data:String):void
           if (!downloadFileRef)
              downloadFileRef = new FileReference ();
           var request:URLRequest = new URLRequest ();
           request.url = CSV_DOWNLOAD_END_POINT; // this is url string for servlet
           request.method = URLRequestMethod.POST;
           request.data = new URLVariables (Data);
           downloadFileRef.download (request, "file.csv");


      I have debug and found that FileReference object show following value for all its properties;

      Error: Error #2037: Functions called in incorrect sequence, or earlier call was unsuccessful.


      Where things are goin wrong ? can any one has solution for this, please reply


      Thanks in advance.