Add method to check for invalid filenames