WordPress plugin development – File upload: How to allow specified file types?

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();
            }

`