def should_upload(mime, file_name):
    """Check if a file should be uploaded, based on file extension
    and  mime type"""

    allways_upload = [".xml", ".csv", ".html", ".txt", ".json"]

    if mime.from_file(file_name).startswith("application"):
        return True

    # check if the file is actually an upload
    # candidate.
    for extension in allways_upload:
        if extension in file_name:
            return True
    return False