Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from flask import Flask, request
- from werkzeug.utils import secure_filename
- import os
- app = Flask(__name__)
- @app.route('/')
- def hello_world():
- return 'Hello, World!'
- FOLDER = 'Recordings/'
- if not os.path.exists(FOLDER):
- os.makedirs(FOLDER)
- @app.route('/file' , methods=['GET' , 'POST'])
- def upload_file():
- try:
- if request.method == 'POST':
- f = request.files['DBFile']
- f.save(FOLDER+secure_filename(f.filename))
- return 'File uploaded successfully'
- except Exception as e:
- print("Exception while running upload_file()" + str(e))
- raise (e)
- if __name__ == '__main__':
- app.run(host="0.0.0.0", port=5000, debug=True)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement