Skip to content

Instantly share code, notes, and snippets.

@danidask
Created January 4, 2018 13:52
Show Gist options
  • Save danidask/e6ad97fee659062cb5449d96038d1b85 to your computer and use it in GitHub Desktop.
Save danidask/e6ad97fee659062cb5449d96038d1b85 to your computer and use it in GitHub Desktop.
phonk temp sever
from flask import Flask, send_from_directory
from flask_restful import reqparse, abort, Api, Resource
import werkzeug
api = Api(app)
class AddImage(Resource):
def post(self):
parse = reqparse.RequestParser()
parse.add_argument('userfile', type=werkzeug.datastructures.FileStorage, location='files')
args = parse.parse_args()
picfile = args['userfile']
picfile.save("pic.png")
return {'status': 'ok'}
# Api resource routing
api.add_resource(AddImage, '/addpic')
if __name__ == '__main__':
app.run(debug=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment