I would like to upload an image and then display that image directly in the same page, under the "Choose file" button, same as shown in the attached picture:
I found a solution for Java, which is described here
For Flask, I had a look at other threads, for example:
python flask display image on a html page
How to serve static files in Flask
However, they are not exactly what I am looking for. I also found a similar question, which has not been answered yet:
Upload an Image and Display it back as a response using Flask
My main idea is having a form
with input
type
of file
:
<form method=POST enctype=multipart/form-data>
<input id="my-file-selector" type="file" name="input_img">
</form>
After uploading the image, it will be displayed directly under the upload button. Does anybody know how to do it with Python Flask?