From dc01beac8cbe742c997f3c78270d32b29775aa1f Mon Sep 17 00:00:00 2001 From: biglyderv Date: Mon, 25 Nov 2024 14:12:43 -0500 Subject: [PATCH] prevent file duping --- static/main.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/static/main.js b/static/main.js index 3748592..bb52829 100644 --- a/static/main.js +++ b/static/main.js @@ -3,9 +3,13 @@ async function formClick(ev) { let { target } = ev; + let fData = new FormData(target); + + target.querySelector('input[type=file]').value = null; + let fetched = await fetch(target.action, { 'method': 'POST', - 'body': new FormData(target) + 'body': fData }); let json = await fetched.json();