bins - quickly upload files to my computer

This commit is contained in:
Felix Van der Jeugt 2015-05-18 14:18:45 +02:00
parent cdeff1aa4f
commit 5db19e2fd0

25
local/bin/saveserver.py Executable file
View File

@ -0,0 +1,25 @@
#!/bin/python
from flask import Flask, request
from werkzeug import secure_filename
app = Flask(__name__)
FORM = """
<html>
<form action="/" enctype="multipart/form-data" method="post">
<input type="file" name="the_file" />
<input type="submit" name="submit" />
</form>
</html>
"""
@app.route("/", methods=["GET", "POST"])
def form():
if request.method == "POST":
f = request.files["the_file"]
f.save('./' + secure_filename(f.filename))
return FORM
if __name__ == "__main__":
app.run(host='0.0.0.0')