sort and asort sort arrays, but DirectoryIterator is not an array, despite providing array-like access (e.g. via foreach). Try creating an associative array from the DirectoryIterator results and sorting that, something like:
$dircontents = array();
foreach ($subdir as $filesInfo) {
$dircontents[$filesInfo->getFilename()] = $filesInfo;
}
sort($dircontents);
foreach($dircontents as $filename => $filesInfo) {
...
}