all repos — honk @ 74409de06d55508eaf85daefb3312dc260055579

my fork of honk

multiple uploads test yksi
Anirudh Oppiliappan x@icyphox.sh
Wed, 19 Jul 2023 09:11:14 +0300
commit

74409de06d55508eaf85daefb3312dc260055579

parent

dc081988e58738d4f2b6749d088bd5dd2753b46b

2 files changed, 17 insertions(+), 15 deletions(-)

jump to
M views/honkform.htmlviews/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.goweb.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)