View Single Post
Old 12-22-2012, 03:24 PM   PM User | #2
Fou-Lu
God Emperor


 
Fou-Lu's Avatar
 
Join Date: Sep 2002
Location: Saskatoon, Saskatchewan
Posts: 15,635
Thanks: 4
Thanked 2,448 Times in 2,417 Posts
Fou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to all
Change the $file_list from a string to an array.
PHP Code:
$aFiles = array();
while (
false !== ($file readdir($handle)))
{
    
$aFiles[$file] = filectime('./content/uploaded' $file);
}
asort($aFiles); 
The files will now be sorted by date created. From here you can create the string and the date using a foreach on the $aFiles instead. The key is your filename (which will be unique of course), and the value is the create time.

There is a way to do this with Iterators as well, although (as much as I like objects) they are a little difficult to do properly since PHP doesn't have a default comparable method on its objects.

Reading the file's name won't issue any type of touch command so the modification date will not change.
Fou-Lu is offline   Reply With Quote