upload: basic folder upload support
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user