Im trying to display a list of files headed by year, i have got the files listed by date using this lot
What i want to do is split them down by year to display the likes of:
2008
_________
File.jpg
File2.jpg
2007
_________
file3.jpg
file4.jpg
Sorting all the files into arrays of years seems a bit much, is there simpler way?
Code:
<?php
// Grab all files from the desired folder
$files = glob( 'upload/*.*' );
// Sort files by modified time
array_multisort(
array_map( 'filemtime', $files ),
SORT_NUMERIC,
SORT_DESC,
$files
);
foreach ($files as $filename) {
$sizeoffile = (filesize($filename)/1024);
$dateoffile = date("d/m/Y",filemtime($filename));
$yearoffile = date("Y",filemtime($filename));
echo '<a href="http://www.mattinglis.com/'.$filename.'">'.$filename.'</a> --- <b>Filesize</b> : '.number_format($sizeoffile, 2, '.', '').' KBytes ----- <b>Modified</b> : '.$dateoffile.'<br>';
}
?>
What i want to do is split them down by year to display the likes of:
2008
_________
File.jpg
File2.jpg
2007
_________
file3.jpg
file4.jpg
Sorting all the files into arrays of years seems a bit much, is there simpler way?