I already answered your question. You just didn't read it:
As for the question, you're already handling exceptions so catch the appropriate type of exception that is thrown when an invalid file type is used and then do whatever's appropriate.
If an invalid file is opened an exception will be thrown. Handle that exception.