Multipart Form Data Extractor (extract/multipart.rs)

axum · axum/src/extract/multipart.rs · rust · MIT
infra, integration, files, lang:rust, fw:axum, tag:multipart

Parses multipart/form-data requests for file uploads in Axum web services. Must be the final extractor in a handler due to body consumption.

// Source: https://github.com/tokio-rs/axum | License: MIT | Copyright 2019–2025 axum Contributors
// Provided via justclaw.it.com; keep this notice with the code.
//! Extractor that parses `multipart/form-data` requests commonly used with file uploads.
//!
//! See [`Multipart`] for more details.

use super::{FromRequest, Request};
use crate::body::Bytes;
use axum_core::{
    __composite_rejection as composite_rejection, __define_rejection as define_rejection,
    extract::OptionalFromRequest,
    response::{IntoResponse, Response},
    RequestExt,
};
use futures_core::Stream;
use http::{
    header::{HeaderMap, CONTENT_TYPE},
    StatusCode,
};
use std::{
    error::Error,
    fmt,
    pin::Pin,
    task::{Context, Poll},
};

/// Extractor that parses `multipart/form-data` requests (commo

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key