Skip to content

Instantly share code, notes, and snippets.



Created Aug 26, 2019
What would you like to do?
Quickly create an HTTP upload form to drop files on your machine.
from flask import Flask, request
from werkzeug import secure_filename
app = Flask(__name__)
@app.route("/", methods=["GET"])
def index():
return """<!doctype html>
<form method="post" enctype="multipart/form-data">
<input type="file" name="file">
<input type="submit">
@app.route("/", methods=["POST"])
def upload():
f = request.files["file"]
return "file uploaded"
if __name__ == "__main__":"")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment