使用flask下载服务器上某个路径下的文件

path:文件路径以及需要下载的文件,直接写入参数有安全隐患,实际应用中需要判断权限之类的

from flask import send_file, make_response    
def down_file(path):
        response = make_response(flask.send_file(path))
        response.headers["Content-Disposition"] = "attachment; filename={};".format(file_name)
        return response

 

相关文章:

  • 2022-12-23
  • 2022-02-07
  • 2022-02-20
  • 2021-11-10
  • 2021-11-25
  • 2021-11-28
  • 2021-07-06
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-01-19
  • 2022-02-13
  • 2021-03-30
  • 2021-10-07
  • 2022-12-23
相关资源
相似解决方案