multiple uploads test yksi
Anirudh Oppiliappan x@icyphox.sh
Wed, 19 Jul 2023 09:11:14 +0300
2 files changed,
17 insertions(+),
15 deletions(-)
M
views/honkform.html
→
views/honkform.html
@@ -9,7 +9,7 @@ <p>
<details> <summary>more options</summary> <p> -<label class=button id="donker">attach: <input type="file" name="donk"><span>{{ .SavedFile }}</span></label> +<label class=button id="donker">attach: <input type="file" name="donk" multiple><span>{{ .SavedFile }}</span></label> <input type="hidden" id="saveddonkxid" name="donkxid" value="{{ .SavedFile }}"> <p id="donkdescriptor"><label for=donkdesc>description:</label><br> <input type="text" name="donkdesc" value="{{ .DonkDesc }}" autocomplete=off>
M
web.go
→
web.go
@@ -1826,20 +1826,22 @@ honk.Donks = append(honk.Donks, d)
donkxid = fmt.Sprintf("%s:%d", d.XID, d.FileID) } } else { - p := strings.Split(donkxid, ":") - xid := p[0] - url := fmt.Sprintf("https://%s/d/%s", serverName, xid) - var donk *Donk - if len(p) > 1 { - fileid, _ := strconv.ParseInt(p[1], 10, 0) - donk = finddonkid(fileid, url) - } else { - donk = finddonk(url) - } - if donk != nil { - honk.Donks = append(honk.Donks, donk) - } else { - ilog.Printf("can't find file: %s", xid) + for _, d := range r.Form["donkxid"] { + p := strings.Split(d, ":") + xid := p[0] + url := fmt.Sprintf("https://%s/d/%s", serverName, xid) + var donk *Donk + if len(p) > 1 { + fileid, _ := strconv.ParseInt(p[1], 10, 0) + donk = finddonkid(fileid, url) + } else { + donk = finddonk(url) + } + if donk != nil { + honk.Donks = append(honk.Donks, donk) + } else { + ilog.Printf("can't find file: %s", xid) + } } } memetize(honk)