Further Fixes

This commit is contained in:
Anthony Stirling
2023-07-26 22:08:19 +01:00
parent bf995f989c
commit 33a6a7869c
5 changed files with 45 additions and 60 deletions

View File

@@ -154,11 +154,22 @@ async function submitMultiPdfForm(url, files) {
if (zipFiles) {
jszip = new JSZip();
}
// Get the form with the method attribute set to POST
let postForm = document.querySelector('form[method="POST"]');
// Get existing form data
let formData = new FormData($('form')[0]);
let formData;
if (postForm) {
formData = new FormData($(postForm)[0]); // Convert the form to a jQuery object and get the raw DOM element
} else {
console.log("No form with POST method found.");
}
//Remove file to reuse parameters for other runs
formData.delete('fileInput');
const CONCURRENCY_LIMIT = 8;
const chunks = [];
for (let i = 0; i < Array.from(files).length; i += CONCURRENCY_LIMIT) {
@@ -169,10 +180,11 @@ async function submitMultiPdfForm(url, files) {
const promises = chunk.map(async file => {
let fileFormData = new FormData();
fileFormData.append('fileInput', file);
console.log(fileFormData);
// Add other form data
for (let pair of formData.entries()) {
fileFormData.append(pair[0], pair[1]);
console.log(pair[0]+ ', ' + pair[1]);
}
try {