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})