Page 1 of 1

Sorting Direcroty file by filemtime()

Posted: Tue Dec 02, 2003 1:40 pm
by kendall
Hello,

Im trying to list the contents of a directory sorting the file by the time they were uploaded...so i used the modified time to base this.

My theory would be to set and array of the files and set the key to be the filetime() of the file. then do a krsort() to sort by unixt time stamp in descending order...

is this an appropriate step in sorting files by the time they were uploaded?

Any suggestions on another approach?

Kendall

Posted: Wed Dec 03, 2003 3:26 am
by mchaggis
No suggestion, but yes i'd use the filemtime(), but depends on what exactly you are doing

Posted: Wed Dec 03, 2003 3:35 am
by Nay
mMm, your way seems more sensible though. But I rarely have any luck working with files - most of the time. So when uploaded, I'd register the filename into a table in the database then when sorting, I call "ORDER BY id DESC".

Well, it's another approach I guess.

-Nay