0

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:

example

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?

hoang tran
  • 3,168
  • 3
  • 15
  • 19
  • If you want to preview the image before uploading [Here](https://stackoverflow.com/questions/4459379/preview-an-image-before-it-is-uploaded). If you want to upload to server first [Here](https://stackoverflow.com/questions/44926465/upload-image-in-flask) – kudeh Dec 11 '19 at 18:42
  • @kudeh I would like to upload it to the server, but the second link you sent is not what I am looking for. In that thread, the image is uploaded to another the html page ``('/register')``, not in the same html page, where the upload button is located – hoang tran Dec 11 '19 at 19:01

0 Answers0