Permalink
Browse files

added flaskpost to address a bug reported on post-buffering

  • Loading branch information...
1 parent de112b7 commit a9ef806a3729d8d9f8f2a5f5523ecbf348fa442c roberto@debian32 committed Jun 12, 2011
Showing with 12 additions and 0 deletions.
  1. +12 −0 flaskpost.py
View
12 flaskpost.py
@@ -0,0 +1,12 @@
+from flask import Flask, request
+app = Flask(__name__)
+app.debug = True
+
+@app.route('/')
+def hello_world():
+ return "<form method='POST' enctype='multipart/form-data' action='/upload'><input type='text' name='pippo'/><input type='file' name='ufile'/><input type='submit' value='upload'/></form>"
+
+@app.route('/upload', methods=['GET', 'POST'])
+def upload_file():
+ return str(len(request.form.get('pippo', 'boh'))) + request.form.get('pippo', 'boh')
+ return request.files['ufile'].read()

0 comments on commit a9ef806

Please sign in to comment.