3 releases (1 stable)

3.0.0 Nov 5, 2022
0.2.0 Apr 29, 2022
0.1.0 Jan 14, 2022

#30 in #multipart-form

Download history 22/week @ 2023-12-05 57/week @ 2023-12-12 81/week @ 2023-12-19 33/week @ 2023-12-26 92/week @ 2024-01-02 47/week @ 2024-01-09 72/week @ 2024-01-16 26/week @ 2024-01-23 42/week @ 2024-01-30 64/week @ 2024-02-06 66/week @ 2024-02-13 166/week @ 2024-02-20 120/week @ 2024-02-27 127/week @ 2024-03-05 226/week @ 2024-03-12 215/week @ 2024-03-19

726 downloads per month
Used in 2 crates

LGPL-3.0

8KB
148 lines

Actix Easy Multipart

Build status crates.io docs.rs

Typed multipart form extractor for actix-web.

⚠ Deprecation notice

This functionality has been now been merged into the official actix-multipart crate (as of version 0.6.0).

Please use the actix-multipart module instead, read the documentation here.

This repository will no longer be maintained.

Example

use actix_web::Responder;
use actix_easy_multipart::tempfile::Tempfile;
use actix_easy_multipart::text::Text;
use actix_easy_multipart::MultipartForm;

#[derive(MultipartForm)]
struct Upload {
    description: Option<Text<String>>,
    timestamp: Text<i64>,
    #[multipart(rename="image_set[]")]
    image_set: Vec<Tempfile>,
}

async fn route(form: MultipartForm<Upload>) -> impl Responder {
    format!("Received 5 images: {}", form.image_set.len())
}

Features

  • Receiving optional fields, using Option.
  • Receiving lists of fields, using Vec<T>.
  • Deserialize integers, floats, enums from plain text fields using Text<T>.
  • Deserialize complex data from JSON uploads, using Json<T>.
  • Receive file uploads into temporary files on disk, using Tempfile.
  • User customisable asynchronous field readers, for example you may want to stream form data to an object storage service, just implement the FieldReader trait.

Versions and Compatibility

actix-easy-multipart actix-web tokio
0.x 2.x 0.2
1.x 3.x 0.2
2.x 4.x 1
3.x 4.x 1

See Also

Dependencies

~1.5MB
~41K SLoC