1 Reply Latest reply on Sep 13, 2009 6:26 PM by Jeff Swartz

    Accessing local files from an AIR sandbox (JavaScript)

    FigCEO Level 1

      I've got a sandbox defined in my AIR application that needs to display images that are stored on the user's local hard disk. Is this even possible under AIR 1.5? How can I define a sandbox such that it can render html image tags as follows:


      <img src="file:///c:/myfile.jpg">

        • 1. Re: Accessing local files from an AIR sandbox (JavaScript)
          Jeff Swartz Level 3

          This is all possible in the application sandbox. Consider the following main file of an HTML-based AIR application:


          <title>Sandbox Bridge Test</title>
          <script type="text/javascript" src="AIRAliases.js"></script>
          <script type="text/javascript">
               function selectFile()
                   file = air.File.documentsDirectory;
                   file.addEventListener("select", selected);
               function selected(e)
                   file = e.target;
                   pict.src = file.url;

              <button onclick="selectFile()">Select</button>
              <img id="pict"/>