I want the following code
var request = new XMLHttpRequest();
request.open("PUT", dbServer + "/configItemAdd");
request.send(new FormData(form));
request.onreadystatechange = function () {
if(request.readyState == 4 && request.status == 200) { window.location.reload(); }
};
to look like this
const fd = new FormData(form);
$http({
method: 'PUT',
url: dbServer + "/configItemAdd",
data: fd
}).then(function (resp){
window.location.reload();
});
the problem is I get two error messages: with just labels and no file input I get SyntaxError: Unexpected token # in JSON at position 0
and with file input I get PayloadTooLargeError: request entity too large
the XMLHttpRequest code is working with and without input files. Please help :S
Content-Type', 'multipart/form-data'as well