Forum Moderators: coopster
//get files timestamp and compare
$dirProc=new DirectoryIterator('pics/');
foreach($dirProc as $dirContent){
if($dirContent->isFile()){
//compare curent file's timestamp to that of stored timestamp. If later, then store it in the vars.
if( $dirContent->getMTime() > $latestdatetime && $dirContent->getSize() > (9 * 1024)) {
$latestdatetime = $dirContent->getMTime();
$latestfilename = $dirContent->getFilename();
}
}
}
I have change the code to make sure the filesize is bigger than the lowest filesize I think it will upload and that helps. But I was wondering if there was a better solution.
Thanks