Пример #1
0
def add_file(file, content_type, filename):
    fs = get_gridfs()
    res = fs.put(
        file,
        content_type=content_type,
        filename=filename
    )
    return  res
Пример #2
0
def get_file_by_id(_id):
    fs = get_gridfs()
    file = fs.get(ObjectId(_id))

    return {"content": file.read()}
Пример #3
0
def add_file(file, content_type, filename):
    fs = get_gridfs()
    res = fs.put(file, content_type=content_type, filename=filename)
    return res
Пример #4
0
def get_file_by_id(_id):
    fs = get_gridfs()
    file = fs.get(ObjectId(_id))
    
    return  {"content":file.read()}