Exemple #1
0
def response_file(fileId, as_attachment):
    file = Model.get_by_id(fileId=fileId)

    fileName = "%d-%s" % (file.fileId, file.fileName)

    return send_file(BytesIO(file.fileContent),
                     mimetype=file.fileMimeType,
                     attachment_filename=fileName,
                     as_attachment=as_attachment)
Exemple #2
0
def response_file(fileId, as_attachment):
    file = Model.get_by_id(fileId=fileId)

    fileName = "%d-%s" % (file.fileId, file.fileName)

    return send_from_directory(directory=FILE_DIRECTORY,
                               filename=str(file.fileId),
                               mimetype=file.fileMimeType,
                               attachment_filename=fileName,
                               as_attachment=as_attachment)
Exemple #3
0
def get_by_id(fileId):
    result = Model.get_by_id(fileId=fileId)

    return Schema().dump(result).data