File size: 581 Bytes
25c6010
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1374362
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
from flask import Flask, request, jsonify

app = Flask(__name__)

@app.route('/upload', methods=['POST'])
def upload_file():
    if 'file' not in request.files:
        return jsonify({'error': 'No file part'}), 400
    file = request.files['file']
    if file.filename == '':
        return jsonify({'error': 'No selected file'}), 400
    if file:
        # Process the file here (e.g., read its content, save it, etc.)
        content = file.read().decode('utf-8')
        # For example, let's just return the content as a response
        return jsonify({'content': content})