• Notice regarding image hosts and attachments. See here.

Page linking to many documents

PR.

PR.

Associate
Joined
29 Mar 2005
Posts
620
Location
Bedford, England
Wonder if someone might be able to help with this:

I do a few very simple web pages for our company, these include posting lots of PDFs. However today I've been given two discs with about 1000 PDFs on them!

I don't really want to manually link to each one, but I can't find anything useful on the net (mostly because I can't word my search correctly!), I looked at a couple of open source DMS but they look over complicated and don't really do what I need.

Ideally I'd like to upload all the files, point a script at the location and it generates the link structure based on folder/files
 
Code:
<?php

$path = '/path/to/files';

if ($handle = opendir($path)) {
    echo "Directory handle: $handle\n";
    echo "Entries:\n";

    while (false !== ($entry = readdir($handle))) {
        echo '<a href="'.$path.'/'.$entry.'">'.$entry.'</a><br />';
    }

    closedir($handle);
}
?>
 
Back
Top Bottom