How to save uploaded image to folder in flask How to save uploaded image to folder in flask flask flask

How to save uploaded image to folder in flask


You are only passing some strings to the handler ("image" and "image_type"). You need to POST the actual data file (image) from the web page to the backend. Then use:

FileStorage(image, image_name, content_type=image_type)

This function cannot go read a file from a folder path on the client. It needs the stream as bytes:

image_bytes = image.read()