use futures::{StreamExt, TryStreamExt}; use ntex::web::{self, Error, HttpResponse}; use ntex_multipart::Multipart; #[web::post("/api/upload")] async fn upload(mut payload: Multipart) -> Result { while let Ok(Some(mut field)) = payload.try_next().await { println!("CT: {:?}", field.content_type()); println!("H: {:?}", field.headers()); while let Some(chunk) = field.next().await { println!("-- CHUNK: \n{:?}", std::str::from_utf8(&chunk?)); } } Ok(HttpResponse::Ok().into()) }