Page 1 of 1

Creating HTML page of folder contents?

Posted: Mon Mar 15, 2004 10:44 am
by Top Wop
I know there is a similar way when one creates a gallery, but is there a way to automatically generate and display contents of a web folder into an HTML page? Or would a directory listing be better and how would I do that? What I am trying to do is upload some various files to our clients to be accessed by login and since there will be so much volume of files, I want to see if I can upload them and organize them in the fastest and best way possible. Thanks for your suggestions!

Posted: Mon Mar 15, 2004 11:52 am
by Tetrad
You can use the default apache directory listing, or if you have PHP you can whip up something really fast. I'd offer to do it myself but I don't know enough PHP to do it off the top of my head. :p

Posted: Mon Mar 15, 2004 12:57 pm
by Tyranny
Theres only one problem with doing the default directory listing which is if your host has directory lists disabled (as mine does) for safety reasons there really isn't much you can do about that method.

Tobycat is picky about that kind of stuff so I don't really pester him about it. Most, though, allow it with no problems.

Perhaps if you're nice enough to Testi he might whip something up for you pretty quickly if it doesn't require a bunch of time.

Posted: Mon Mar 15, 2004 7:42 pm
by DCrazy
Here's a PHP page that gets a list of all files in the same directory (except for the PHP page itself):

Code: Select all

<html>
<title>Directory listing</title>
</head>
<body>
<pre>
<?php

$thispage = basename($_SERVER['PHP_SELF'];
foreach(glob('*') as $name)
{
  if($name !== $thispage)
  {
    echo "<a href=\"$name\">$name</a>
  }
";
}
?>
</pre>
</body>
</html>

Posted: Mon Mar 15, 2004 9:30 pm
by MD-2389
http://gallery.menalto.com/modules.php? ... file=index

Thats what I'll be using soon to show off my 3D artwork.

Posted: Mon Mar 15, 2004 10:28 pm
by Iceman
ls -a | awk '{print $1"<br>"}' | grep -v "files.html" > files.html

Posted: Tue Mar 16, 2004 11:55 am
by Defender
I wonder if top even knows unix commands? :)

No offense of course. :P

Posted: Tue Mar 16, 2004 12:34 pm
by Top Wop
Unfortunately the only thing the server supports is ASP. No php, no CGI, none of that, so it made my job difficult, especially considering I had no choice but to code the rest of the website using FrontPage (eeewww!)

However I did manage to find a VERY nice program which supports ASP and looks very nice and allows you to restrict what file types are to be seen and can hide directories you dont want to show. Its DirList2.1.1 and I highly reccomend it that you check it out. {url=http://fx-scripts.com/dirlist.asp]Linky.[/url]