From 54c08213390cd26e0202d54f37c8a1ca5cab928a Mon Sep 17 00:00:00 2001 From: Jeff Becker Date: Sun, 1 Oct 2017 11:46:28 -0400 Subject: [PATCH] construct formdata manually --- contrib/static/overchan.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/contrib/static/overchan.js b/contrib/static/overchan.js index 418e848..967ad98 100644 --- a/contrib/static/overchan.js +++ b/contrib/static/overchan.js @@ -105,8 +105,21 @@ onready(function() { elem.innerHTML += "."; } }; + var data = new FormData(); + data.append("message", document.getElementById("comment").value); + var inputs = form.getElementsByTagName("input"); + for(var input : inputs) + { + if(input.files) + { + for (var file : input.files) + data.append(input.name, file, file.name); + } + else if(input.name) + data.append(input.name, input.value); + } ajax.open(form.method, form.action+"/json"); - ajax.send(new FormData(form)); + ajax.send(data); }; var elems = document.getElementsByClassName("postbutton"); if(elems && elems.length > 0 && elems[0]) {