(m, data, collection=settings.COL_SAMPLES)
return m
Add a file to storage.

    :param m: The filename.
    :type m: str
    :param data: The data to add.
    :type data: str
    :param collection: The collection to grab the file from.
    :type collection: str
    :returns: str
Add a file to storage.
Add a file to storage .
def put_file_gridfs(m, data, collection=settings.COL_SAMPLES):
    """
    Add a file to storage.

    :param m: The filename.
    :type m: str
    :param data: The data to add.
    :type data: str
    :param collection: The collection to grab the file from.
    :type collection: str
    :returns: str
    """

    mimetype = magic.from_buffer(data, mime=True)
    try:
        fs = gridfs_connector("%s" % collection)
        fs.put(data, content_type="%s" % mimetype, filename="%s" % m)
    except Exception as e:
        logger.error(e)
        return None
    return m
def put_file_gridfs ( m , data , collection = settings . COL_SAMPLES ) : mimetype = magic . from_buffer ( data , mime = True ) try : fs = gridfs_connector ( "%s" % collection ) fs . put ( data , content_type = "%s" % mimetype , filename = "%s" % m ) except Exception as e : logger . error ( e ) return None return m