check_filename function

Check if the filename is valid