fix file validation to use PHP native method