I am sure this must be common but I can't seem to find how to do it.
I have a file structure as follows:
php
- getimages.php
gallery
- index.html
- image1.jpg
- image2.jpg
- image3.jpg
inside of index.html I have
<a href="http://bytes.com/submit/304/ ../php/getimages.php">View images</a>
what I want to do is in getimages.php be able to set the directory to ./gallery
Naturally I can hard code this but I would like to have a generic solution just in case I move my php folder, or have a more complex directory structure.
I thought i could solve this in two ways
1) send document.location from index.html, something like this:
<a href="./php/getimages.php?document.location" ....
(notice I have index.html, not a php file and I can't change this)
2) in getimages.php somehow determine where the request is coming from, maybe use REQUEST_URI
But I am sure there must be a more elegant approach.