From 023dd9007035c4f7223175bb04aef83b402ff98a Mon Sep 17 00:00:00 2001 From: Janne Koschinski <janne@kuschku.de> Date: Sun, 18 Mar 2018 18:22:19 +0100 Subject: [PATCH] Improved upload API --- templates/upload.html | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/templates/upload.html b/templates/upload.html index aa98173..8351784 100644 --- a/templates/upload.html +++ b/templates/upload.html @@ -44,9 +44,14 @@ img.src = e.target.result; node.appendChild(img); results.appendChild(node); + + const data = new FormData(); + data.append("file", file); + fetch("/upload", { method: "POST", - credentials: "same-origin" + credentials: "same-origin", + body: data }).then((response) => { return response.json() }).then((json) => { -- GitLab