Currently I'm trying to make a javascript button that when clicks sends an Http Post request to a javaservlet. I see how one can get a file ready to send from here. However, I don't know the syntax to have the form send both a file and text strings as parameters to a servlet.
Currently, I'm trying to do something along the lines of
var form = document.createElement("Form");
form.setAttribute("Method", "POST");
var formData = new FormData();
var blob = new Blob(['Lorem ipsum'], { type: 'plain/text' });
formData.append('file', blob,'myfile.xml')
form.setAttribute("FIle", "myfile.xml");
form.setAttribute("contentTYpe", "text/xml");
document.body.appendChild(form);
form.submit();
However my servlet can't seem to grab these attributes. I keep sysout only null