Jump to content

Function for returning list of filenames in a directory??


paulferree

Recommended Posts

I was wondering if there was a function that would help me create a page that will look at a folder (an image folder, that I predefine) and return all the file names in that folder.

 

Is there a function already made for this, if there isn't how would I go about creating one?

 

I just want to upload my images to a folder and have the php extract them all and display them on the page.

 

Any ideas?

 

Thanks,

Paul

I was looking at this one BTW:

 

[pre]<?php

$dir = "/tmp";

$dh  = opendir($dir);

while (false !== ($filename = readdir($dh))) {

    $files[] = $filename;

}

 

sort($files);

 

print_r($files);

 

rsort($files);

 

print_r($files);

 

?>

[/pre]

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.