Skip to content
Myr

Update allowed_file function in fileuploads.rst

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Update allowed_file function to accept lowercase and uppercase file extensions

authored by Shakib Hossain · committed by GitHub · parent 495d834 · Browse files · 1 file+1 added−1 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+1 added−1 removed

  • other:+1 added−1 removed

1 file+1 added−1 removed

modified:docs/patterns/fileuploads.rst+1 added-1 removed
45 unmodified lines
46the file and redirects the user to the URL for the uploaded file::4748 def allowed_file(filename):49 return '.' in filename and \50 filename.rsplit('.', 1)[1] in ALLOWED_EXTENSIONS50 filename.rsplit('.', 1)[1].lower() in ALLOWED_EXTENSIONS5152 @app.route('/', methods=['GET', 'POST'])53 def upload_file():54 if request.method == 'POST':
130 unmodified lines