tags:

views:

22

answers:

2

How can we access the Folders out side the Web root Directory?

We are using WAMPSERVER 2.0(Apache 2.2.11,php 5.3.0 & My Sql 5.1.36 )

please Help me out

+1  A: 

I think you just need to learn how to read directories in php http://www.webcheatsheet.com/PHP/working_with_directories.php

sushil bharwani
A: 
usr
| - www
     |- docs
        |- A
     |- webroot
        |- index.php

Just use "normal" file paths. E.g. to access A in the docs folder from index.php, you can use relative paths like ../docs/A or absolute paths like /usr/www/docs/A.

The "webroot" directory only marks the entry point for URLs. This has no effect on PHP files. They are just normal files in a filesystem and can therefore access other files in the system via ordinary file paths.

Felix Kling
mohammedk1000
@mohammedk1000: Then I guess you can access the folder via `C:\test1` from your PHP script. If you don't know how to access files or directories in general, [have a look at the available functions](http://www.php.net/manual/en/refs.fileprocess.file.php).
Felix Kling
mohammedk1000
@mohammedk1000: This is not possible this way. As I said, the web root marks the entry point for a URL. The purpose is that one **cannot** access every file in the system via an URL. You can only access the files from inside your PHP script. Or you have to move or link this file in your web root directory.
Felix Kling
mohammedk1000
how can we Link the files in web root directory
mohammedk1000
Dear Felix Kling, instead of moving the file in Web root directory I wanted to Link the files/Directory in Web root Directory, How can We Link the files/Directories in web root directory ? Many thanks for the Reply
mohammedk1000
@mohammedk1000: It is at easy as creating a normal link to a file in Windows. Sorry, I don't use Windows, but I guess you have to right click on the file you want to link to and select `Create link...` or similar and move the link to the web root.
Felix Kling
mohammedk1000
@mohammedk1000: Mmh ok, maybe it does not work on Windows. Works for me on Linux. Sorry.
Felix Kling
thanks for the Response Felix Kling, i coud not understand one thing about ur Reply " You can only access the files from inside your PHP script " It means we need to Write a PHP Script ? pleae Help me out in this - Great Thanks
mohammedk1000
@mohammedk1000: Well, you tagged the question as PHP so I was assuming your are using PHP anyway.
Felix Kling
mohammedk1000
hi Experts, please Help me out in Resolving my Requirement. Great thanks
mohammedk1000