backup for multer

This commit is contained in:
selcuk committed 2022-07-07 12:56:00 +03:00
1 parent ee1cfb2fe7
commit 679934a90a
6 files changed
+59 -47

No files matched your search

+32
View File
@@ -0,0 +1,32 @@
console.log("Hello from signer");
// script.js
const form = document.getElementById("form");
form.addEventListener("submit", submitForm);
function submitForm(e) {
e.preventDefault();
const mainFile = document.getElementById("mainFile");
const imgFiles = document.getElementById("imgFiles");
const xpos = document.getElementById("xpos");
const ypos = document.getElementById("ypos");
const sf = document.getElementById("sf");
const formData = new FormData();
formData.append("xpos", xpos.value);
formData.append("ypos", ypos.value);
formData.append("sf", sf.value);
formData.append("files", mainFile.files[0]);
for (let i = 0; i < imgFiles.files.length; i++) {
formData.append("files", imgFiles.files[i]);
}
fetch("http://localhost:3000/invoice_sign/upload_files", {
method: "POST",
body: formData,
headers: {
// "Content-Type": "multipart/form-data",
},
})
.then((res) => console.log(res))
.catch((err) => ("Error occured", err));
}