public static function isValidFileName($strName)
{
if ($strName == '') {
return false;
}
// Special characters not supported on e.g. Windows
if (preg_match('@[\\\\/:*?"<>|]@', $strName)) {
return false;
}
// Invisible control characters or unused code points
if (preg_match('/[\\pC]/u', $strName) !== 0) {
return false;
}
// Must not be longer than 255 characters
if (mb_strlen($strName) > 255) {
return false;
}
return true;
}