Added validation check for file names.