2 Replies Latest reply on Aug 28, 2012 9:08 AM by adobe_paul

    Is it possible to read files in an Air application from the local hard drive?

    BrandonMX84

      As the topic states, is it possible in AIR 3.x to read files from the local user's hard drive?  I have an application that reads data from local files multiple times per second and then sends that data to an FMS server using shared objects, so I need to keep this app flash based for the Flash Media Server connectivity.  Currently, my app is just an SWF file that I run locally off the local hard drive and I enable it to read from the local drive under the developer settings in the flash player preferences.  This is not a widely distributed app, so if something similar is available in the AIR framework, that would work OK for me.

       

      Thanks in advance.

        • 1. Re: Is it possible to read files in an Air application from the local hard drive?
          BrandonMX84 Level 1

          To further clarify, I know AIR 1.x allowed files to be read from the hard drive, and then in 2.x it was either revoked or restricted to the Documents directory.  I need this app to have access to a directory within C:\Program Files that contains data from the application we are plugging in to.

          • 2. Re: Is it possible to read files in an Air application from the local hard drive?
            adobe_paul Adobe Employee

            AIR was never restricted to only reading files from the Documents directory, although it sometimes seems that way.

             

            An AIR app runs with the permission of the user who is running the app. If the operating system allows that user to read a file from C:\Program Files, the AIR app should also be able to read that file.

             

            In most cases, operating systems will allow the user to read files from the "Program Files" directory, but won't allow the user to create or modify a file in that location. For AIR applications that need to create or edit a file, the recommendation is to use the "application storage directory" -- you can access it using the File.applicationStorageDirectory property.

             

            Of course, if you're not creating or editing the file, and you just need to read it, then you probably can't choose where it's saved. Nevertheless, in most cases I've seen, especially on Windows, you should be able to read a file from the "Program Files" directory without any problem.

             

            Paul Robertson

            Adobe Developer Relations