def build_file_upload_error_response(asset: dict, error_msg: str=''):
    """
    Builds a proper error response to the jquery-file-upload browser client

    {"files": [
      {
        "name": "picture1.jpg",
        "size": 902604,
        "error": "Filetype not allowed"
      },
      {
        "name": "picture2.jpg",
        "size": 841946,
        "error": "Filetype not allowed"
      }
    ]}

    :param error_msg:
    :param asset: A dict containing necessary data
    :return: A properly formatted response
    """
    response = dict()
    response['files'] = list()
    file_dict = dict()
    file_dict['name'] = asset.get('file_name', '')
    file_dict['size'] = asset.get('file_size', '')
    file_dict['error'] = error_msg
    response['files'].append(file_dict)
    return response
