i want a shared folder which contains images to be accessed by html pages inside sub folders.(child folders)
Basically, there are two ways of linking to a resource (page/script/image/whatever):
- Use an absolute link:
http://www.yourserver.com/path/to/resource.jpg
- Use a relative link: for example, to go from
http://www.yourserver.com/path/from/page.html
tohttp://www.yourserver.com/path/to/resource.jpg
, you use../to/resource.jpg
So just put your images on a publicly accessibly folder, and refer to them using one of those two methods.
Or refine your question :)
If you mean your html folder and images folder are siblings, you're probably looking for the ..
directory... um, thingy.
Your files look like:
/www
/html
index.php
/images
myimage.png
Write an img tag like this:
<img src="../images/myimage.png" />
You can get the directory of the current file with the dirname funciton:
dirname(__FILE__)
If you want the parent directory you can use '..' thus:
$current_dir = dirname(__FILE__);
$parent_dir = $current_dir.'/..';
If I got it right, you have a folder with many folders inside, and inside does many folder you have html pages, and you want does pages to access the first folder...
main_folder
pic.png
pic.gif
pic.jpg
sub_folder
html_page.php
just use ../pic.png when you call the image file from the html_page.php
Was this what you where looking for ?