How prevent uploading of certain filetypes

How would you go about preventing users from uploading certain filetypes, such as *.exe files or script files like *.vbs and others?

Either by detecting the file type already at upload, or deleting it immediatly once uploaded.