swope Posted October 17, 2007 Share Posted October 17, 2007 I have a problem I'm stuck on ... I've searched all over the web and have been unable to find an answer, so perhaps someone has some insight. I want to list the files in a given <dir> with a given file extension ... opendir() or scandir() would seem to be my solution. BUT! those files are outside the root dir of the site ... accessed via an apache alias. so opendir() and similar functions do not seem to work as I cannot feed it a relative path. is there a way to do this? my page: <http://myintranet/prodinfo/listdir.php> http location of dir to be listed: <http://myintranet/dailies/> /dailies/ is an alias pointing elsewhere on the server. indexing has been turned on for this alias in apache, so loading the above URL shows the dir contents by default. so for example ... this works because /images is in the root of the web dir: $myDir = "../images/"; $scanFiles = scandir($myDir); print_r($scanFiles); this does not work as dailies is an alias and not a dir in the web root: $myDir = "../dailies/"; $scanFiles = scandir($myDir); print_r($scanFiles); one option I see is to grab the html of that apache auto-generated index page and parse the content to grab the links out of it. but this seems rather roundabout, and with all the great php file tools, I'm hoping there's a much simpler way. does anyone have any ideas, or is there some addtl info I can provide to make my question clearer? thanks for any help ... Quote Link to comment https://forums.phpfreaks.com/topic/73580-list-files-in-directory-for-apache-alias/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.