2 Replies Latest reply on Aug 9, 2009 10:33 PM by Hitesh_Patel

    How to get remote file properties in Adobe AIR

    Hitesh_Patel

      Hi Folks,

       

      I am developing a desktop application in AIR wherein we have a requirement for Live Update. I need a mechanism by which I can check the last modified date time of a file and if a new version is available, I need to download it.

       

      I am able to download the file from remote server. But the main issue is reading the last modified date time. Is there any way to get this information in AIR.

       

      Any help/suggestions would be highly appreciated.

       

      Thanks,

      Hitesh Patel (India)

        • 1. Re: How to get remote file properties in Adobe AIR
          Jeff Swartz Level 3

          This depends on the type of server from which you are downloading the files. For example, if you are downloading the files from an HTTP server, and the server provides "Last-Modified" values in the HTTP response headers, you could use the following ActionScript code to determine those values:

           

          var urlReq:URLRequest = new URLRequest("http://www.example.com/");
          var urlStream:URLStream = new URLStream();
          urlStream.addEventListener(HTTPStatusEvent.HTTP_RESPONSE_STATUS, statusListener);
          urlStream.load(urlReq);

           

          private function statusListener(event:HTTPStatusEvent):void
          {
              for each(var header:URLRequestHeader in event.responseHeaders)
              {
                  if(header.name == "Last-Modified")
                  {
                      trace(header.value);
                  }
              }
          }

          • 2. Re: How to get remote file properties in Adobe AIR
            Hitesh_Patel Level 1

            Hey Jeff,

             

            Thanks a lot... This really worked..

             

            Regards,

            Hitesh Patel