Re: Show Folder Contents in Form

From: Date: Mon, 02 Dec 2002 21:16:53 +0000
Subject: Re: Show Folder Contents in Form
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-126762@lists.php.net to get a copy of this message
you could first read the files and their modified-dates into an array; sort the array; and finally build a select widget from the array... function sortByTime($a, $b) { if ($a["time"] == $b["time"]) return 0; return ($a["time"] < $b["time"]) ? -1 : 1; } while (false !== ($file = readdir("/some/directory/"))) { if ($file != "." && $file != "..") $files[] = array("file" => $file, "time" => filectime("/some/directory/".$file)); } usort($files, "sortBytime"); echo "<select>"; while (list(,$filearr) = each($files)) echo "<option value=\"".$filearr["file"]."\">".$filearr["file"]." ".$filearr["time"]; "Stephen" <webmaster@melchior.us> wrote in message news:000901c29a46$590a2320$0200a8c0@melchior... > Hello, > > Is it possible, and if so how, to get the filenames and last edited > time/date, then display them in a select field in a form for a user to > select? I'd need to show them in order of most recently edited to last > edited. How can this be done if it can? > > Thanks, > Stephen Craton > http://www.melchior.us > > "Life is a gift from God. Wasting it is like destroying a gift you got from > the person you love most." -- http://www.melchior.us >

« previous php.general (#126762) next »