What problem does it solve?
This Skill helps you implement reliable Axum file-upload endpoints that accept real multipart/form-data uploads while enforcing safe body limits, correct extractor ordering, streaming to avoid memory blowups, and proper handling of MultipartError instead of production panics.
Core Features & Use Cases
- Correct multipart handler structure: Ensures
Multipart is the only body-consuming extractor and is the last handler argument, preventing compile-time failures and runtime misbehavior.
- Safe iteration and field reading: Drives
next_field() until Ok(None) and reads field metadata (name/filename/content-type) before consuming the body via bytes(), text(), or chunk().
- Body limit and DoS resistance: Uses
DefaultBodyLimit (and when needed RequestBodyLimitLayer) to avoid default 2MB rejections, prevent unbounded uploads, and return appropriate 413-class behavior.
- Secure file handling: Avoids path traversal by never trusting
file_name() for destination paths, and prefers streaming chunk() into tokio::fs::File to keep peak memory bounded.
Quick Start
Use the axum-impl-file-upload skill to design a production-ready Rust handler for /upload that streams an uploaded file to disk safely, sets a clear request body ceiling, and returns a 400 response on malformed multipart bodies instead of panicking.