From 644c15452fff9769bbd3b1e6723fe6c40cd1bfc9 Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Tue, 21 Jan 2025 11:07:48 -0600 Subject: Assign returned names to file-input names When using the chunked upload process, the final file names are returned as part of the response indicating successful upload of all the chunks and the merging of the chunks into a single file. The name of the final uploaded file is used in place of the file object that would otherwise have been uploaded. --- uploader/templates/phenotypes/add-phenotypes-raw-files.html | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'uploader') diff --git a/uploader/templates/phenotypes/add-phenotypes-raw-files.html b/uploader/templates/phenotypes/add-phenotypes-raw-files.html index 9eef50d..b799da7 100644 --- a/uploader/templates/phenotypes/add-phenotypes-raw-files.html +++ b/uploader/templates/phenotypes/add-phenotypes-raw-files.html @@ -564,6 +564,16 @@ }; }; + var processForm = (form) => { + var formdata = new FormData(form); + uploaded_files.forEach((msg) => { + formdata.delete(msg["file-input-name"]); + formdata.append(msg["file-input-name"], msg["uploaded-file"]); + }); + formdata.append("resumable-upload", "true"); + return formdata; + } + var uploaded_files = new Set(); var submitForm = (new_file) => { uploaded_files.add(new_file); -- cgit v1.2.3