upload: basic folder upload support

This commit is contained in:
Lukas Werner
2026-08-11 14:11:47 -07:00
parent 9644f101b3
commit c8ec356c3e
6 changed files with 80 additions and 32 deletions
+3
View File
@@ -5,6 +5,7 @@ import (
"encoding/json"
"fmt"
"io"
"log"
"net/http"
"time"
@@ -18,6 +19,7 @@ func UploadFiles(client valkey.Client) func(w http.ResponseWriter, r *http.Reque
return func(w http.ResponseWriter, r *http.Request) {
err := r.ParseMultipartForm(125_000_000) // 1G max memory usage
if err != nil {
log.Println("error in parsing form: ", err.Error())
http.Error(w, err.Error(), http.StatusBadRequest)
return
}
@@ -26,6 +28,7 @@ func UploadFiles(client valkey.Client) func(w http.ResponseWriter, r *http.Reque
expiry_values := form.Value["expiry"]
expiry, err := time.ParseDuration(expiry_values[0])
if err != nil {
log.Println("error in getting expiry: ", err.Error())
http.Error(w, err.Error(), http.StatusBadRequest)
return
}