use actix_multipart::Field; use futures::StreamExt; pub fn get_field_name(field: &Field) -> Result { field .content_disposition() .ok_or_else(|| actix_web::error::ParseError::Incomplete)? .get_name() .map(|s| s.to_owned()) .ok_or_else(|| actix_web::error::ParseError::Incomplete) } pub async fn read_string( mut field: actix_multipart::Field, ) -> Result { let mut data = Vec::new(); while let Some(chunk) = field.next().await { data.extend(chunk.unwrap()); } String::from_utf8(data) }