5 Replies Latest reply on Aug 24, 2007 7:22 AM by TomNelson

    Possible to load file from outside of web root?

      I have a number of MP3 files which I want to import into a flash audio player I have built. Despite the fact that I am happy for the tracks to be listened to via the flash player I would prefer that the users weren't able to download the MP3 files directly. I am currently storing the MP3's above the web root and want to reference them in the flash movie using an absolute path, something along the lines of:


      However, I'm not sure of the format for this path or if the security settings within Flash will permit this. I've seen a couple of posts that talk about UNC paths, or using the file:// protocol, but nothing seems definitive and the various paths I have tried so far all fail.

      Any assistance greatly appreciated.
        • 1. Re: Possible to load file from outside of web root?
          Level 7
          You probably want to reference the files using a relative path naming
          scheme. On the server, the drive certainly won't be C:.

          /a some mp3 files

          You have main movie in root and then a music folder with folders a and b
          within it. From flash the path to some mp3 files in the a folder would be:


          Dave -
          Head Developer
          Adobe Community Expert

          • 2. Re: Possible to load file from outside of web root?
            TomNelson Level 1
            Hi Dave,

            Thanks for your response.

            The requirement for using an absolute path is to access files that are outside of the web root. If the MP3s were stored below the root then a relative path (as per your description below) would be fine. However, to keep the MP3s in a directory that isn't directly accesible from a browser I was hoping to use an absolute path.

            On the server I have a directory on the data drive (you're right, it's not the C: drive!) where the MP3's are stored. I can access these files from my VB application by using the file system object, making them accessible to an authorised user but not directly accessible by inputting a URL into a browser. This is what I was hoping to achieve in Flash - the actionscript will load the mp3 file into my movie using an absolute path to locate it on the server, but the mp3 file itself can't be accessed directly through a browser as it is above the web root.

            Is there an established format for calling files using an absolute path in Flash when using the loadMovie or loadSound actions?
            • 3. Re: Possible to load file from outside of web root?
              kamckng Level 1
              as far as i know flash does not allow this... is this your own server? like apache? or is this a server somewhere else? if it is your own you will have to configure the server itself to not allow access to the folders from outside... if it is someone elses you'll have to talk to them... i think for security reasons flash is not able to access the harddrive like that.

              now, i did read somewhere that i think as of flash 8 they have an object that can open up a file browser window... but you have to use another language i think like php or js to actually make use of it... i could be wrong because i can no longer find where i read it, but i'm almost positive i did
              • 4. Re: Possible to load file from outside of web root?
                kamckng Level 1
                ok i did find the fileReference object... it will open up the dialog box for browsing files, but i think it is used only for choosingfiles to upload or download.
                • 5. Re: Possible to load file from outside of web root?
                  TomNelson Level 1
                  Hi kamckng,

                  Thanks for your comments.

                  I think that you're right. It seems that Flash won't allow you to access files on the server that are outside of the web root for (understandable) security reasons. The solution that I've come up with is to use the file system object to access the MP3 with VB, then stream that track to the Flash movie and load it as a sound object.

                  I think that's probably the best solution until actionscript is modified to allow access to directories on the server outside of the web root.