Вставка вырезанного изображения с компьютера в html-кодPython

Программы на Python
Гость
Вставка вырезанного изображения с компьютера в html-код

Сообщение Гость »


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'
I tried to insert an tag if there is something in

Код: Выделить всё

request.files['file']
, but actually I think I have a problem getting the absolute path to a file.


Источник: https://stackoverflow.com/questions/781 ... -html-code

Вернуться в «Python»