python - 使用 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 个文件发送到用户端。我能怎么做?
解决方案
HTTP 不支持此功能,但您可以将文件压缩到存档中并将其发送给用户。
推荐阅读
- react-native - 使用 RealmDB React Native 推送通知
- java - Android - 执行 AsyncTask 线程的问题
- php - Livewire/Alpine Dom 模板未更新
- reactjs - 使用缩放后 Highstock 返回平移
- swift - 停止在 Swift 中收听 NSEvent
- wordpress - 我可以使用导入功能更新 Woocommerce 中的可变产品吗?
- python - 将 python scipy.optimize.minimize 与评估值和梯度的函数一起使用
- android-studio - Android Studio 如何获取我使用 Volley 通过 post 方法请求的会话 cookie
- javascript - 将分钟添加到时间对象
- bash - 查找用 bash 脚本编写的命令输出命令未找到