From b89209fa5a02ec8d24ec32c9a59d394921071b3b Mon Sep 17 00:00:00 2001 From: onezDerv Date: Fri, 20 Sep 2024 15:34:16 -0400 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();