diff --git a/server/go/camlistored/ui.go b/server/go/camlistored/ui.go index c6d62a3bd..9cc428ec5 100644 --- a/server/go/camlistored/ui.go +++ b/server/go/camlistored/ui.go @@ -233,7 +233,16 @@ func (ui *UIHandler) serveUploadHelper(rw http.ResponseWriter, req *http.Request http.Error(rw, "Multipart error: "+err.String(), 500) break } - br, err := schema.WriteFileFromReader(ui.Storage, part.FileName(), part) + fileName := part.FileName() + if fileName == "" { + continue + } + get, _ := http.ParseQuery(req.URL.RawQuery) + writeFn := schema.WriteFileFromReader + if len(get["rollsum"]) == 1 && get["rollsum"][0] == "1" { + writeFn = schema.WriteFileFromReaderRolling + } + br, err := writeFn(ui.Storage, fileName, part) fmt.Fprintf(&buf, "filename=%q, formname=%q, br=%s, err=%v\n", part.FileName(), part.FormName(), br, br, err) diff --git a/server/go/camlistored/ui/index.html b/server/go/camlistored/ui/index.html index e20f9dd3f..be4b0bbc7 100644 --- a/server/go/camlistored/ui/index.html +++ b/server/go/camlistored/ui/index.html @@ -36,15 +36,8 @@
+
- - diff --git a/server/go/camlistored/ui/index.js b/server/go/camlistored/ui/index.js index 50660de48..0ad1d2f6e 100644 --- a/server/go/camlistored/ui/index.js +++ b/server/go/camlistored/ui/index.js @@ -33,6 +33,26 @@ function indexOnLoad(e) { } btnNew.addEventListener("click", btnCreateNewPermanode); camliGetRecentlyUpdatedPermanodes({ success: indexBuildRecentlyUpdatedPermanodes }); + + if (disco && disco.uploadHelper) { + var uploadForm = document.getElementById("uploadform"); + uploadform.action = disco.uploadHelper; + document.getElementById("fileinput").disabled = false; + document.getElementById("filesubmit").disabled = false; + var chkRollSum = document.getElementById("chkrollsum"); + chkRollSum.addEventListener("change", function (e) { + if (chkRollSum.checked) { + if (disco.uploadHelper.indexOf("?") == -1) { + uploadform.action = disco.uploadHelper + "?rollsum=1"; + } else { + uploadform.action = disco.uploadHelper + "&rollsum=1"; + } + } else { + uploadform.action = disco.uploadHelper; + } + }); + } + } function indexBuildRecentlyUpdatedPermanodes(searchRes) {