def upload()

in source/api/app.py [0:0]


def upload(filesystem_id):
    """
    Uploads a file

    :param filesystem_id: The filesystem to perform operation on
    :param path: The path to upload the file
    :param filename: The name of the file
    :returns: Filesystem operation response
    :raises ChaliceViewError, BadRequestError
    """
    print(app.current_request.query_params)
    try:
        path = app.current_request.query_params['path']
        filename = app.current_request.query_params['filename']
    except KeyError as error:
        app.log.error('Missing required query param: {e}'.format(e=error))
        raise BadRequestError('Missing required query param: {e}'.format(e=error))

    request = app.current_request
    chunk_data = request.json_body
    chunk_data["filename"] = filename

    filemanager_event = {"operation": "upload", "path": path, "chunk_data": chunk_data}

    operation_result = proxy_operation_to_efs_lambda(filesystem_id, filemanager_event)
    error_message = "Error uploading file"

    return format_operation_response(operation_result, error_message)