Created
November 13, 2015 20:07
-
-
Save brijeshb42/a5618b2b15c519ee2db0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from flask import Flask, request | |
app = Flask(__name__) | |
@app.route("/", methods=['GET', 'POST']) | |
def upload(): | |
if request.method == 'GET': | |
return """ | |
<form enctype="multipart/form-data" method="POST"> | |
<input type="file" name="file" /> | |
<input type="submit" value="Submit" /> | |
</form> | |
""" | |
fil = request.files['file'] | |
print(fil.filename) | |
fil.save('./'+fil.filename) | |
return "OK" | |
if __name__ == '__main__': | |
app.run(host='0.0.0.0', debug=True) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment