Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can i show directory contents in a web page?

Status
Not open for further replies.

JaybOt

Programmer
Apr 18, 2001
101
GB
Hi there,

I need to set up a webpage that will show all the file in the current directory (without specifying / ) and refresh the page every 10 second to reflect any changes to the directory "Always know what you say, but don't always say what you know!"
 
i've been wondering this same thing too (just the no '/' needed. not the refresh part). anyone out there that can help?
 
I believe if there is no default file in the directory (usually index.html), the contents of the directory will be displayed.

I'm not sure how to have it updated every 10 seconds, but I'm sure there is probably a script that would do that.
 
Here's what you need:

1) Apache has to be compiled with support for mod_autoindex. (which is usually in a default configuration)

2) In httpd.conf, Loadmodule and Addmodule have to call for mod_autoindex:
Code:
LoadModule autoindex_module   libexec/mod_autoindex.so

AddModule mod_autoindex.c
Finally, you have to set the
Code:
Indexes
option in the
Code:
Options
directive in your
Code:
Directory
container. Here's an example directory container:

Code:
<Directory /home/rick/public_html/browse_dir>
    AllowOverride FileInfo AuthConfig Limit
    Options MultiViews ExecCGI Indexes SymLinksIfOwnerMatch Includes IncludesNoExec
    IndexOptions FancyIndexing
    <Limit GET POST OPTIONS PROPFIND>

        Order allow,deny
        Allow from all
    </Limit>
    <LimitExcept GET POST OPTIONS PROPFIND>
        Order deny,allow
        Deny from all
    </LimitExcept>
</Directory>
This directory container allows viewers to browse the directory &quot;/browse_dir&quot; from my home html directory at &quot; As long as I don't have an index.html file (or whatever is defined as an index), then the users can browse files and folders in that directory. The
Code:
IndexOptions FancyIndexing
line means that icons will be used for recognized filetypes and folder icons will be used for directories. Often you don't need this line here because FancyIndexing has been turned on globally further down in httpd.conf.
 
i have everything set up correctly, but there is 1 problem: I have apache 1.3.19 for Windows, but there is no libexec/mod_autoindex.so file anywhere. I looked for this file online but only found a hundred references about it, but not download. If i install the latest apache server, will it be included? if not, where else can this mod file be obtained?
 
I'm not too familiar with Apache for windows, so I can't be much help, but this is one of the more standard features of Apache, so it wouldn't surprise me if it is enabled somehow, even if not as a loadable module. Have you tried the other configuration directives, just to see if it works?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top