This commit is contained in:
louiscklaw
2025-01-31 22:59:12 +08:00
parent b3cc8e8323
commit 2f380a6c09
201 changed files with 31229 additions and 0 deletions

View File

@@ -0,0 +1,33 @@
from flask import Flask, request, send_from_directory
from werkzeug.utils import secure_filename
import tempfile
import json
from pprint import pprint
from flask_cors import CORS
app = Flask(__name__)
app.config['MAX_CONTENT_LENGTH'] = 16 * 1024 * 1024
app.config['UPLOAD_FOLDER'] = tempfile.gettempdir()
CORS(app)
@app.route('/uploader', methods = ['GET', 'POST'])
def upload_file():
if request.method == 'POST':
print("hello post request")
pprint(request.files)
# f = request.files['file']
# f.save(secure_filename(f.filename))
# print("helloworld")
# return json.dumps({'hello':'world'})
return json.dumps({'hello':'world'})
@app.route('/uploads/<filename>')
def download_file(filename):
return send_from_directory(app.config['UPLOAD_FOLDER'], filename)
if __name__ == '__main__':
app.run(debug = True)