Advertisement
Guest User

Untitled

a guest
Jun 19th, 2019
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. @app.route('/get_file', methods=["GET"])
  2. def get_file():
  3. filepath = request.args.get('filepath')
  4. dirname, fname = os.path.split(filepath)
  5. return send_from_directory(dirname, fname, as_attachment=True)
  6.  
  7. {% for path in data %}
  8. <img class='lazy' data-src="{{ url_for('get_file', filepath=path) }}">
  9. {% endfor %}
  10.  
  11. import asyncio
  12.  
  13. @app.route('/get_file', methods=["GET"])
  14. async def get_file():
  15. filepath = request.args.get('filepath')
  16. dirname, fname = os.path.split(filepath)
  17. await send_from_directory(dirname, fname, as_attachment=True)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement