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

Method upload

forms/multipart-s3/src/client.rs:74–81  ·  view source on GitHub ↗
(&self, file: &TempFile, key_prefix: &str)

Source from the content-addressed store, hash-verified

72 }
73
74 async fn upload(&self, file: &TempFile, key_prefix: &str) -> UploadedFile {
75 let filename = file.file_name.as_deref().expect("TODO");
76 let key = format!("{key_prefix}{filename}");
77 let s3_url = self
78 .put_object_from_file(file.file.path().to_str().unwrap(), &key)
79 .await;
80 UploadedFile::new(filename, key, s3_url)
81 }
82
83 async fn put_object_from_file(&self, local_path: &str, key: &str) -> String {
84 let mut file = fs::File::open(local_path).await.unwrap();

Callers 1

upload_and_removeMethod · 0.80

Calls 1

put_object_from_fileMethod · 0.80

Tested by

no test coverage detected