Input validation for files.