Skip to content
Myr

Doc for add check upload file

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

authored by Wing · committed by Wing · parent da1c1f0 · Browse files · 1 file+9 added−0 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+9 added−0 removed

  • other:+9 added−0 removed

1 file+9 added−0 removed

modified:docs/patterns/fileuploads.rst+9 added
54 unmodified lines
5556 @app.route('/', methods=['GET', 'POST'])57 def upload_file():58 if request.method == 'POST':59 # check if the post request has the file part60 if 'file' not in request.files:61 flash('No file part')62 return redirect(request.url)63 file = request.files['file']64 # if user does not select file, browser also65 # submit a empty part without filename66 if file.filename == '':67 flash('No selected file')68 return redirect(request.url)69 if file and allowed_file(file.filename):70 filename = secure_filename(file.filename)71 file.save(os.path.join(app.config['UPLOAD_FOLDER'], filename))72 return redirect(url_for('uploaded_file',
118 unmodified lines