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)
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)
def get_by_id(fileId): result = Model.get_by_id(fileId=fileId) return Schema().dump(result).data