1
0
Fork 0
mirror of https://github.com/vbatts/imgsrv.git synced 2025-07-06 00:58:30 +00:00

client upload works again

This commit is contained in:
Vincent Batts 2013-10-10 10:31:27 -04:00
parent 96a4b57924
commit adbdffbfb4
3 changed files with 27 additions and 29 deletions

View file

@ -729,12 +729,15 @@ func routeUpload(w http.ResponseWriter, r *http.Request) {
return
}
useRandName := false
returnUrl := false
log.Printf("%q", r.MultipartForm.Value)
for k, v := range r.MultipartForm.Value {
if k == "keywords" {
info.Keywords = append(info.Keywords, strings.Split(v[0], ",")...)
} else if k == "rand" {
useRandName = true
} else if k == "returnUrl" {
returnUrl = true
} else {
log.Printf("WARN: not sure what to do with param [%s = %s]", k, v)
}
@ -781,6 +784,10 @@ func routeUpload(w http.ResponseWriter, r *http.Request) {
n)
}
if returnUrl {
fmt.Fprintf(w, "/v/%s", filename)
return
}
http.Redirect(w, r, fmt.Sprintf("/v/%s", filename), 302)
} else {
httplog.LogRequest(r, 404)