Skip to content

Instantly share code, notes, and snippets.

@PhilippHomann
PhilippHomann / app.py
Last active August 7, 2024 07:36
FastAPI file upload with streaming_form_data to parse multipart/form-data
from fastapi import FastAPI, UploadFile, HTTPException
from starlette.requests import Request
from streaming_form_data import StreamingFormDataParser
from streaming_form_data.targets import FileTarget
from tempfile import NamedTemporaryFile
import os
import shutil