Are you using Apache? If so, mod_autoindex can give you automatically generated file listings (HTML pages) of directories the server is configured to access — in case no other explicit index (index.html) is found for the respective directory. Files will typically appear as clickable links, but you can flexibly configure the appearance in many ways (file sorting, with icons, descriptions, etc.).
To get you started, here's a sample configuration snippet (incomplete) for your httpd.conf:
LoadModule autoindex_module modules/mod_autoindex.so
LoadModule alias_module modules/mod_alias.so
Alias /chat /path/to/directory/chat
# ...so you can access the chat directory via http://servername/chat
<Directory /path/to/directory/chat>
Options +Indexes
IndexOptions FancyIndexing
# ...
</Directory>
| [reply] [d/l] [select] |
Thank you but I use webhotel so I have no acces to server files....
Can it be done with CGI-script?
kari
| [reply] |
print "<a href=\"/chat/$f\"> $f </a><br />";
The exact format of the href="..." depends on how your
server is configured to access the file, whether you want it served as
a static file, or delivered as a dynamic resource (via another CGI script)
with a specific MIME type, or with plain text being rendered into HTML,
and such...
BTW, directly generating HTML is just the most primitive form there is... Normally, you'd use some module (like CGI.pm, or one of the many templating modules/frameworks), which would make your life easier — among other things, by taking care of stuff like escaping special characters in file names properly, etc.
| [reply] [d/l] [select] |