Skip to content

Instantly share code, notes, and snippets.

@skwzrd
skwzrd / flask_backend.py
Last active August 2, 2020 00:27
Upload a File from React to a Flask API
# the flask post request receiver
from io import BytesIO
from flask import jsonify, request
@app.route('/url_route', methods=['POST'])
def upload_file():
"""Handles the upload of a file."""
d = {}
try:
file = request.files['file_from_react']