summaryrefslogtreecommitdiffstats
path: root/src/files.rs
diff options
context:
space:
mode:
authorSanto Cariotti <santo@dcariotti.me>2022-09-13 13:10:04 +0000
committerSanto Cariotti <santo@dcariotti.me>2022-09-13 13:10:04 +0000
commit412494edf618b8eda71656855656f9b8b21c3eae (patch)
tree72ddf711989eadd23b47471123c982d75a761e87 /src/files.rs
parent987e5d92ea9043b588cb7887861bb05a3a0695c4 (diff)
Delete an uploaded file
Diffstat (limited to 'src/files.rs')
-rw-r--r--src/files.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/files.rs b/src/files.rs
index 0bc531d..16a11b6 100644
--- a/src/files.rs
+++ b/src/files.rs
@@ -55,6 +55,13 @@ pub async fn upload(
))
}
+/// Delete a file from the filesystem
+pub async fn delete_upload(filename: String) -> Result<(), AppError> {
+ fs::remove_file(filename)?;
+
+ Ok(())
+}
+
/// Axum endpoint which shows uploaded file
pub async fn show_uploads(Path(id): Path<String>) -> (HeaderMap, Vec<u8>) {
let index = id.find('.').unwrap_or(usize::max_value());