def save_blob(session, localfile=None, resource=None):
    """
        put a local image on the server and return the URL
        to the METADATA XML record

        @param session: the local session
        @param image: an BQImage object
        @param localfile:  a file-like object or name of a localfile
        @return XML content  when upload ok

        @exceptions comm.BQCommError - if blob is failed to be posted
    """
    content = session.postblob(localfile, xml=resource)
    content = session.factory.string2etree(content)
    if len(content) < 1:
        return None
    return content[0]
