"download_file" should be "upload_file"

per the function name.
Otherwise you get an error.
"werkzeug.routing.BuildError: Could not build url for endpoint 'download_file' with values ['name']. Did you mean 'upload_file' instead?"
This commit is contained in:
eyalsela 2021-12-11 01:03:29 +02:00 committed by GitHub
parent 776bf09fdf
commit 3241e9059d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -63,7 +63,7 @@ the file and redirects the user to the URL for the uploaded file::
if file and allowed_file(file.filename): if file and allowed_file(file.filename):
filename = secure_filename(file.filename) filename = secure_filename(file.filename)
file.save(os.path.join(app.config['UPLOAD_FOLDER'], filename)) file.save(os.path.join(app.config['UPLOAD_FOLDER'], filename))
return redirect(url_for('download_file', name=filename)) return redirect(url_for('upload_file', name=filename))
return ''' return '''
<!doctype html> <!doctype html>
<title>Upload new File</title> <title>Upload new File</title>