[Pugged] File listings
Angie Tollerson
ciapug@ciapug.org
Fri, 22 Nov 2002 09:21:22 -0600
Something like this?
$exts = array("pdf","PDF");
echo "<b>PDF's in this folder:</b>";
$dir = opendir(".");
$files = readdir($dir);
while (false !== ($files = readdir($dir))) {
foreach ($exts as $value) {
if (CheckExt($files, $value)) {
echo "<a href=\"$files\">$files</a>\n";
$count++; //Keep track of the total number of files.
break; //No need to keep looping if we've got a match.
}
}
function CheckExt($filename, $ext) {
$passed = FALSE;
$testExt = "\.".$ext."$";
if (eregi($testExt, $filename)) {
$passed = TRUE;
}
return $passed;
}
Angie
Angie Tollerson
Alliance Technologies Web Programmer
(515) 245-7628
tollerson@alliancetechnologies.net
>>> dave@58ghz.net 11/22/02 05:42 AM >>>
I'm looking for some sample code.
I've got a script that makes some pdf files. I need some code that will
find all the *.pdf files, put them in order by there file names, and
then create a page of links so someone can download them
Anyone know where there are some PHP 4.x samples that does this?
:) Dave
--
"...Unix, MS-DOS and Windows NT (also known as the Good, the Bad, and
the Ugly)"
OSIS
Dave J. Hala Jr.
641.485.1606
_______________________________________________
Ciapug mailing list
Ciapug@ciapug.org
http://cialug.org/mailman/listinfo/ciapug