首页 > 解决方案 > 使用 Flask 发送多个文件?

问题描述

我有这个代码用于将单个文件发送到用户端:

客户端:

@app.route('/image, methods = ['GET','POST'])
def image():
    # CU.close()
    SqlPicPlace="SELECT ImgData  FROM  tablename WHERE ImgSaveID=2  " 
    CU.execute(SqlPicPlace)
    ans=CU.fetchone()
    imgBinary =  ans[0]    
    return send_file(  io.BytesIO(imgBinary),  attachment_filename='a.jpg',   mimetype='image/jpg' ,as_attachment=True )

但我想发送超过 1 个文件发送到用户端。我能怎么做?

标签: pythonflasksendfile

解决方案


HTTP 不支持此功能,但您可以将文件压缩到存档中并将其发送给用户。


推荐阅读