MCPcopy Create free account
hub / github.com/actix/examples / save_files

Function save_files

forms/multipart/src/main.rs:20–30  ·  view source on GitHub ↗
(
    MultipartForm(form): MultipartForm<UploadForm>,
)

Source from the content-addressed store, hash-verified

18}
19
20async fn save_files(
21 MultipartForm(form): MultipartForm<UploadForm>,
22) -> Result<impl Responder, Error> {
23 for f in form.files {
24 let path = format!("./tmp/{}", f.file_name.unwrap());
25 log::info!("saving to {path}");
26 f.file.persist(path).unwrap();
27 }
28
29 Ok(HttpResponse::Ok())
30}
31
32async fn index() -> HttpResponse {
33 let html = r#"<html>

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected