Skip to content

Instantly share code, notes, and snippets.

Created October 31, 2016 17:59
What would you like to do?
simple flask server which receives files and stores them locally
import os
from flask import Flask, request
from werkzeug.utils import secure_filename
app = Flask(__name__)
app.config['UPLOAD_FOLDER'] = '.'
@app.route('/', methods=['POST'])
def upload_file():
file = request.files['filedata']
if file:
filename = secure_filename(file.filename)['UPLOAD_FOLDER'], filename))
return 'it worked'
return 'no file'
@app.route('/', methods=['GET'])
def index():
return 'it works'
if __name__ == '__main__':'', port=80, debug=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment