I have a form that has a button to select an image. I need to select an image and after reloading the page the image appears in the form. How can I do it? I'm writing on Python, Flask. Here is the code of the page:
Код: Выделить всё
@app.route('/load_photo', methods=['GET', 'POST'])
def load_photo():
global FILE
if request.method == 'GET':
return f'''
Пример формы
Анкета претендента
на участие в миссии
{'
[img] + FILE.filename + [/img]
' if FILE else ''}
Приложите фотографию
Отправить
'''
elif request.method == 'POST':
#i dont know what can I do here
return 'ok'
Код: Выделить всё
imgКод: Выделить всё
request.files['file']Источник: https://stackoverflow.com/questions/781 ... -html-code