Solution:
Very basically…
$allowed_extenstions=array('jpg','png','pdf','zip');
$ext = pathinfo(esc_attr($_FILES['file']['name']), PATHINFO_EXTENSION);
if (!in_array($ext,$allowed_learning_extenstions))
{
echo "invalid_file_type";
die();
}
`