Jump to content

Recommended Posts

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 ...

Link to comment
https://forums.phpfreaks.com/topic/73580-list-files-in-directory-for-apache-alias/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.