Access files outside of web root?

Hello, everyone.
Hypothetical scenario.
Say I wanted to have a file that would set globally accessible variables for containing passwords, and I want to place said file outside of web root, so users cannot access it.
Logical paths obviously won't work.  And the cfinclude tag doesn't use physical paths.
I've never done this, before.  What are my options?
Thank you,
^_^

Almost all your CFML files should not be in a web-browseable directory!  Only the ones people actually browse to should be web accessible.
Files do not need to be web accessible to be <cfinclude>-ed or be instantiated as objects, or used as a custom tag.
EG:
C:\webapps\myapp <= this dir is the root as far as ColdFusion is concerned
C:\webapps\myapp\wwwroot <= that dir is the webroot as far as the web server goes
C:\webapps\myapp\includes <= files you <cfinclude>
C:\webapps\myapp\api <= CFCs
The only stuff that should be in that wwwroot dir is files people actually browse to (index.cfm, etc), and asset files like images, JS and CSS which need to be served to the browser.
The bulk of your CFM files should be in a subdir of C:\webapps\myapp.
So index.cfm needs to be browseable, and it needs to use the data in secretSecureStuff.cfm which is in the includes dir.  So index.cfm just has:
include "/myapp/includes/secretSecureStuff.cfm";
If the file to be included isn't in the myapp subdir structure for whatever reason, then you can create a mapping in CFAdmin or Application.cfc to point to it, eg:
/external => C:\stuff\somewhere\else
And you'd reference C:\stuff\somewhere\else\outside.cfm via:
include "/external/outside.cfm";
Adam

Similar Messages

  • Problems while accessing images outside the web document-root folder

    Our application runs on Oracle application server on Linux. Facing problems while accessing images outside the web document-root folder. This works with changes in global-web-application.xml by including the <virtual-directory> tag. The same change does not work when done on Linux machine. It is unable to find the image. Please help in resolving this issue.
    </locale-encoding-mapping>
    </locale-encoding-mapping-list>
    </web-app>
    <virtual-directory virtual-path="/img" real-path="/home/eposuat/" />
    </orion-web-app>
    Code in the jsp:
    <img width=700 height=700 src="/img/3.tif"></img>
    <img width=700 height=700 src="/img/WB.gif"></img>

    This is one of the least satisfactory aspects of site management in Dreamweaver, and several developers, including myself, have been pressuring the Dreamweaver team for some years to improve this. Who knows? They might eventually take notice.
    The only way to do this at the moment is to create two site definitions, one nested inside the other. Set up the site definition normally based on htdocs as your site root. Then create a new site definition based on site. Dreamweaver will nag you that it can cause problems, but it won't actually stop you from doing it. The only potential problem is with site synchronization.
    The problem with using site as the only basis for your site definition is that Dreamweaver automatically puts things like the Connections, Scripts, and other folders in the site root. So, everything ends up at the wrong level of the site hierarchy. Quite frankly, the whole thing is a bit of a pain. Dynamic site development was added to Dreamweaver only in version 6 (Dreamweaver MX), and no one had really thought through the need to store files outside the site root.

  • Accessing files outside the root of the site.

    Hi All
    On my web host space I have access to a directory outside the
    root of the
    website i.e. "private"
    I want to store files there for download after users have
    purchased them.
    I want to put them here to stop people ripping the files off
    by guessing the
    link or useing a website copier.
    What I plan to do is send a link to the user via email, this
    link will then
    go to a download page which records the user has accessed the
    file and then
    have the page automatically download the file.
    I can do this no problem if I have the files in a directory
    under the root
    of the site but how can I link to the files outside the root?
    TIA
    Bren
    Why do I climb mountains? Simple! because they are there
    www.3peakschallenge.co.uk

    Sorry forgot to mention I am using ASP VB
    Cheers
    Bren
    "Bren" <[email protected]> wrote in message
    news:ejgd9n$427$[email protected]..
    > Hi All
    >
    > On my web host space I have access to a directory
    outside the root of the
    > website i.e. "private"
    > I want to store files there for download after users
    have purchased them.
    > I want to put them here to stop people ripping the files
    off by guessing
    > the link or useing a website copier.
    > What I plan to do is send a link to the user via email,
    this link will
    > then go to a download page which records the user has
    accessed the file
    > and then have the page automatically download the file.
    > I can do this no problem if I have the files in a
    directory under the root
    > of the site but how can I link to the files outside the
    root?
    >
    > TIA
    > Bren
    > --
    > Why do I climb mountains? Simple! because they are there
    > www.3peakschallenge.co.uk
    >

  • How to access files outside a .jar file netbeans project

    Hi, i need to access a file outside a built project inside netbeans. Ideally i would like this file next to the .jar file as myapp.properties. If possible i would like it so that when i am compiling and running the project in netbeans the file can be with the class files or something along those likes. Either way it would be nice to have different code for built projects and just running them outside a jar.
    Heres what i got so far
    properties = new Properties();
                InputStream in = this.getClass().getResourceAsStream("applications.properties");
                properties.load(in);
                in.close();this only works if the file is next to the classes. (think thats called the classpath ? )
    Thanks for any replies!!

    Your wrong code:
    properties = new Properties();
    InputStream in
    = this.getClass().getResourceAsStream("applications.properties");
    properties.load(in);
    in.close();A right code:
    // basic assumption 1: applications.properties
    //  is a pure ISO 8859-1 text file
    // basic assumption 2: the file applications.properties
    //  is stored in the same directory where your
    //  jar file is stored
    properties = new Properties();
    try{
      FileInputStream in      // assume current dir
       = new FileInputStream("applications.properties");
      properties.load(in);
      in.close();
    catch (Exception e){
      e.printStackTrace();
    }

  • Accessing PDF files outside the web application

    Hi,
    I have deployed a web application Tomcat / webapps/ Moto.
    The Tomcat / webapps / Moto / resource.jsp file has links
    to a pdf file located outside the Moto web app.
    The pdf file is in Tomcat / webapps / doc / BAServerConfig.pdf.
    Now, I'm unable to access this pdf from the resource.jsp page.
    Is there any way i can do this?
    I'm not supposed to move this pdf file to any location.
    Please suggest.
    Thanks in advance,
    Phani

    I havent tested, but if it doesn't work, it should give you the idea:
    <%@ page contentType="application/pdf;charset=TIS-620" %><% response.setHeader("Content-Disposition","attachment; filename="+request.getParameter("id").substring(request.getParameter("id").lastIndexOf("/")+1));
      try{
        FileInputStream fis=new FileInputStream(request.getParameter("id"));
        ByteArrayOutputStream baos=new ByteArrayOutputStream();
        byte buffer[]=new byte[1024];
        int length;
        while((length=fis.read(buffer))>=0) baos.write(buffer, 0, length);
        baos.writeTo(response.getOutputStream());
      catch(Exception e){
        throw new ServletException(e);
    %>Be aware to not to broke ... %><%..... with spaces or return characters.
    And if this work, you can convert it to a servlet and enter corresponding entries in web.xml file.
    Hope this help,
    OO

  • Loading application files outside CF app root (CF+JBoss)

    I have CF9 installed as an EAR file in JBoss 5.1.0 ($JBOSS_HOME/server/default/deploy/cfusion.ear -- on local disk).  I would like to place the custom application files on a shared file system (e.g. /apps/mycfapp) outside of the path $JBOSS_HOME/server/default/deploy/cfusion.ear/cfusion.war.  With JRun, you could map to a different resource path by modifying cfusion.ear/cfusion.war/WEB-INF/jrun-web.xml.
    Ex:
        <virtual-mapping>
            <resource-path>/*</resource-path>
            <system-path>/apps/mycfapp</system-path>
        </virtual-mapping>
    Is there a way to modify/specify the path to the custom application files with other application servers?  Or is this not possible at all and all of the files must be deployed into the $JBOSS_HOME/server/default/deploy/cfusion.ear/cfusion.war directory?
    Desired behavior: When I access http://www.mydomain.com/cfusion/index.cfm, ColdFusion would load index.cfm from /apps/mycfapp/index.cfm instead of $JBOSS_HOME/server/default/deploy/cfusion.ear/cfusion.war/index.cfm

    I need some help with this as well.
    I think that it is a CF configuration issue and has nothing to do with JBoss.
    My presumptions:
    1.  On a linux box, I "should" be able to make a symlink in the cfusion.war directory that points to a external directory that contains .cfm files.
    2.  CF has a "Server Settings -> Mappings" page that I think "should" allow this to work.
    So far, I can't get either of these 2 techniques to work.
    My particular intallation is on RHEL5, using JBoss 5 and CF9.
    I installed CF9 as an EAR in the JBoss deploy directory.
    For me, that is:  /opt/JBoss/server/default/deploy/cfusion.ear
    If I put a "test.cfm" file in /opt/JBoss/server/default/deploy/cfusion.ear/cfusion.war/rick/test.cfm, it works fine.
    But, I need to place the .cfm files on a shared drive that is outside the cfusion.war directory structure.
    I expected that a symbolic link in the cfusion.war directory that pointed to my shared directory would work, but it does not.
    For example if I replace the "rick" directory with a symlink that points to /cfmfiles, I would expect that to work.
    OR, if that doesn't work then I would expect that I could create a mapping from the CF Administrator that points logical path "/rick" to "/cfmfiles" directory path.  That does not work either.
    So, is there any way to configure CF9 on JBoss that allows me to put the .cfm files somewhere other than the cfusion.ear/cfusion.war directory?
    Thanks,
    Rick

  • Creating and accessing file outside isolated storage

    Hello,
    I'm trying to learn to write apps in c#. 
    I want to create an app that can save my location in a file that I can acces on my computer. 
    I was wondering if someone could explain to me how I can create folders and files that I can acces outside of the app, or if there is a site where they already explain this.
    I have been searching for a few hours now, but I can't find it.
    I hope someone can help me.
    Thanks

    Hi TomTom93,
    As far as I known, we can create folder and files within the isolated storage but we can not acess it
    outside of app except some public folders. Because every app has his own
    isolated storage and all of them are independent. If you want to save some information which can be access out of the app, I will recommand you use the
    WCF Service or database.
    Best Regards,
    Amy Peng
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Applet security -- accessing files over the Web.

    I guess the topic pretty much sums up my question..
    I have an applet and I want to read a file from over the web.
    After creating a URL, I try to retrieve an inputstream by calling openStream() but I get all the java.security.AccessControlException: access denied rubbish..
    How do I get it working ?

    The applet can only read data from the server where it is saved. For security purposes applets have limited capabilities. They can't write data to a remote hard drive or read data from remote machines. A way around this is to create a "trusted applet". Basically what it does is informs any machine you are trying to access that you wrote this applet and are responsible for any negative outcome. There is a tutorial provided by Sun that can explain this better than I can. Here is the link:
    http://java.sun.com/security/signExample/index.html
    Good luck.

  • Accessing files outside the jar

    Greetings,
    I've got a jar file with some classes, which is in a directory. In this dir there are also some resources. How to access those resources from inside the jar?
    Thanks in advance,
    imaginner

    Try this...
    In your class, add this line...
    String path = System.getProperty("user.dir");
    it will give the path of the folder from which you are running
    your jar file. To this path, add your properties file name
    and start reading it.....
    For example:
    If i have a properties file which both :
    1) should be able to read and edit by users and
    2) should be accessible by classes in jar file....
    I would use the above concept like this.... in my class.....
    String path = System.getProperty("user.dir");
    Properties props = new Properties();
    props.load(new FileInputStream(path+"yourPropertiesFileName"));
    Hope it helps...
    Vijay

  • Accessing files from custom web application

    I have created a JSP application using UIX components that you can search for files within in IFS. After searching for the files I want the user to click a link and access the document, much like the webui interface in the out of the box IFS. I'm able display the list of files found but I'm not able to allow the user to click the in MY APPLICATION to see the files. What would be the url to access these files that are stored in IFS. PLEASE HELP.
    Jeff

    Hi,
    I also have the same problem .
    I have to open the document from the repository after clicking on the link and end user should be able to edit and save it in the same place in the repository.
    Can you suggest me any solution if you have found?

  • Access files from Web Dynpro component

    Hi,
    I need to access files from a Web Dynpro component but I couldn't find any information. Has anyone done this?
    My questions are:
    1. Can I pack these files into the WD component so they can be deploy together?
    2. And what API should I use to access these files?
    Thanks,
    Kizza

    Hi,
    You can follow the Creating the JCO connections in the Content Administrator section in the following
    help.sap.com [link|http://help.sap.com/saphelp_nw70/helpdata/EN/f8/bdfe80d9a3b048a5fb32a7d149774e/content.htm].
    For the RFC_ERROR_COMMUNICATION error, you can check if the system sapmsR3D is defined in your
    SAP Logon pad or in the hosts file under Drivers -> etc folder.
    Regards,
    Alka.

  • Accessing files in a different package

    Hello,
    Is there a way to access files outside the current package in Java?
    I have a situation where I need to get the URL object out of a file, but it requires the file to be in the current directory of the class, is there a way to access file based on package name?
    URL url = getClass().getResource(filename);
    Your help would be appreciated as always.
    Thanks.
    --Raj                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

    This doesn't sound like a package issue as much as it is a classpath issue. If you put an arbitrary directory on your classpath, a call to getResource() will search that directory for the file.

  • [HELP]don't allow access folder in web root, but allow dowload files in it?

    Hi all!
    I got a big problem, at least ... with me .. uhm ... I have a web application, which I allow user upload file on, I save that file in a folder below the web root, I mean ... www.mywebapp/files/uploadFile.zip <--- something like that...
    I don't want user to able to access files folder, but ... I allow who has already login as admin of my web app can download that files :( ...
    how can I do that ... plz help me :(
    thanks in advance :(

    Put the "files" folder under the WEB-INF directory.
    Nothing can access the WEB-INF directory directly.
    Then write a servlet that will get requests, and send back the file.
    Alternatively you can use web.xml security constraints, to define who can/can't access the files.

  • How to access file vault outside my account ?

    I have enabled file vault on my account and now, obviously I lost access to my files outside it. The problem is I always used the root user to backup my computer data (this way i can remove all cache files). So, how do i get access to my files when logged in as root ?

    This question would probably be best posted in the Mac OS X forums as it has nothing to do with your MacBook. The folks more familiar with Mac OS X's features might be found there. But, I don't think you can get access to those files through the root user (or any user) as that's the whole point of using File Vault: Protect your data by encrypting it. If there was a work-around for this, File Vault would be compromised.
    -Doug

  • Unable to export data from Web Access Data Sheet in Sharepoint to local excel or access file

    Greetings and good morning.
    I'm going to start off in broad terms with this question because I'm not 100 percent sure what information to provide.
    Long story short, we've got a Web Access Data Sheet list hosted in a Sharepoint 2010 environment. It is accessed and used by multiple people throughout the day. It contains several thousand line item entries. I'd call it a large data sheet.
    I think the size of the data sheet is casuign some instability in the list. I'd like to be able to export a defined range of data from the list into a local excel or access file. After that, I'd delete the stuff on the Access list to improve performance.
    But...when I attempt to use the Sharepoint Action bar to export - Excel locks up/crashes. If I try to export to Access, I get a similar issue.
    Any ideas? Could anyone begin by telling me what other information is required?

    Hi,
    If you would like to export data from Access Web Database in SharePoint 2010, you could go to Design With Access page in Settings. The url in my environment is http://sp/tt/_layouts/accsrv/ModifyApplication.aspx . Then choose the Table and export it to Excel
    or Modify it in Access.
    Regards,
    Rebecca Tu
    TechNet Community Support

Maybe you are looking for

  • JTree node lazy loading + icons problem

    Hi all, I need to build a large tree (10000 nodes). Since this is large to load all at once, i want to load the last level dynamically using the 'treeWillExpand' Level 1 --Level 2 ---Lever 3 ----Node loaded dynamically 4.1 ----Node loaded dynamically

  • Function of Outbox

    I am using an iMAC with OS X, version 10.9.4. My problem is inability to easily send e-mail.  Since doing updates on all programs now when I have an e-mail drafted and hit "Send"  the e-mail goes into the "outbox"  which I never previously used.  To

  • How can you upgrade a mac 10.5.8 into a mac 10.6 or higher, how can you upgrade a mac 10.5.8 into a mac 10.6 or higher

    I just wanna know if it is possible. If it is, please try to explain to me how. Thanks!!!

  • Leopard and snow leopard licence

    Quick question regarding licences for os x 10.5 and os x 10.6. I'm currently running os x 10.6 and wanted to pass on my os x 10.5 licence, however just wanted to check it's something I can do. Snow leopard was sold as an 'upgrade' so just wanted to c

  • JDeveloper or Eclipse?

    Hello, What is the preferred tool for Oracle 10g? The BPEL dev guide seems to focus mostly on the Eclipse BPEL designer. Does this mean JDeveloper will eventually go away? Thanks.