axum-impl-file-upload

Official

Stream safe uploads without 413s or panics.

AuthorImpertio-Studio
Version1.0.0
Installs0

System Documentation

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.

Dependency Matrix

Required Modules

None required

Components

references

💻 Claude Code Installation

Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.

Please help me install this Skill:
Name: axum-impl-file-upload
Download link: https://github.com/Impertio-Studio/Axum-Claude-Skill-Package/archive/main.zip#axum-impl-file-upload

Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
View Source Repository

Agent Skills Search Helper

Install a tiny helper to your Agent, search and equip skill from 471,000+ vetted skills library on demand.