4 Replies Latest reply on Jul 21, 2008 12:42 PM by Hamshmam

    Can't download remote files with Adobe AIR

    Hamshmam Level 1
      Hi all,

      I have an adobe AIR application that tries to allow the user to directly download a remote file. Here's the current code:

      var fileRef:FileReference = new FileReference();
      // Bunch of Event listeners here
      var urlReq:URLRequest = new URLRequest(" http://www.randomfilehere.com/hello.txt");
      fileRef.download(urlReq);

      Now, when I try to download any random file, let's say http://www.example.com/buca-di-beppo.gif, I will get a OS-specific download box that asks me where to save the file; I choose desktop and 'save' yet nothing happens (but when I trace the HTTP response through Fiddler I get HTTP/1.1 200 OK, and apparently all data has been successfully transferred to the host machine, it just is not saved as a file.

      A worse problem occurs with getting a file through HTTPS, as in https://www.example.com/secure-image.gif. Air will try to initiate approximately 3,940 http requests (plus or minus 3), that all return 200 OKs, before eventually stalling (and sometimes getting a 502).

      Does anyone have any idea how to resolve these problems? The AIR application is of course not a browser-based application so I didn't think the cross-domain.xml would be applicable here (and if it is, I don't know where to put it). Any help would be GREATLY appreciated! Thanks very much for your time.