Flask uploads route is not working, what should be directory structure?

11 Views Asked by At

I am trying to upload and file and download a file. I can upload the file but i can not download the file.

Below is my project structure: enter image description here

Below is my UPLOAD_FOLDER details and download or view end point:

in below code name=filename

UPLOAD_FOLDER = os.path.join('app1/static')


@bp.route('/uploads/<name>')
def download_file(name):
    print(UPLOAD_FOLDER, name)
    return send_from_directory(UPLOAD_FOLDER, name)
0

There are 0 best solutions below