Script Upload Files Ajax

I am using this Upload Form together with PHP in an existing WordPress project. A question regarding this Upload Form: Q.) I notice that inside the provided PHP script, it supposedly checks for the file type when a file is uploaded. But even though a file type outside of $allowed is uploaded, it will still be shown as uploaded on front-end. Is there an event-handler to prompt the user an error message instead of echoing to console?
















