I\'m new in Flask, I want to take single file that have been uploaded in my upload path. Then i want to read and send it to my html after hr tag. How can i do that?
This
@app.route('/<filename:filename>')
.file_path = os.path.join('UPLOAD_PATH', filename)
.with open(file_path) as file:
content = file.read()
<p>{{ content }}</p>
Here is a complete example of the route I described:
@app.route('/<filename:filename>')
def display_file(filename):
file_path = os.path.join('UPLOAD_PATH', filename)
with open(file_path) as file:
content = file.read()
return render_template('display_file.html', content=content)