0

Im trying to making an simple application that you can upload an image and retrieve it from the system. i did the upload image and its working correctly but when i retrieve the image its returning this error TypeError TypeError: argument of type 'NoneType' is not iterable. I already checked if its saving correctly on the database and as far as i know its 100% correct

This is my upload route:

def upload_image(app):
    @app.post("/")
    def upload():
        mongo = PyMongo(app)
        if 'file' in request.files:
            file = request.files['file']
            mongo.save_file(file.filename, file)
            return {"file name": file.filename}

and this is my retrieving route which is returning the above error:

def get_image(app):
   @app.get("/get_file/<filename>")
   def get_file(filename):
    mongo = PyMongo(app)
    return mongo.send_file(filename)

Does anyone knows how to fix it ? pleaseee

Gustavo
  • 41
  • 6
  • Could you please share the whole error Traceback? – Patrick Yoder Jan 29 '22 at 15:59
  • 1
    Sure! i'll leave the link for the print of the error too -> https://prntscr.com/26li52e TypeError TypeError: argument of type 'NoneType' is not iterable Traceback (most recent call last) – Gustavo Jan 29 '22 at 17:57

0 Answers0