【问题标题】:Send multiple files with Flask?使用 Flask 发送多个文件?
【发布时间】:2020-05-17 21:04:31
【问题描述】:

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

客户端:

@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 个文件发送到用户端。我能怎么做?

【问题讨论】:

标签: python flask sendfile


【解决方案1】:

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

【讨论】:

  • 一个文件和一个 json 怎么样?
猜你喜欢
  • 1970-01-01
  • 2017-09-24
  • 1970-01-01
  • 2019-11-17
  • 1970-01-01
  • 1970-01-01
  • 2018-05-20
  • 2012-08-02
  • 1970-01-01
相关资源
最近更新 更多