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" <[EMAIL PROTECTED]> wrote in message
000901c29a46$590a2320$0200a8c0@melchior">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
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to