I've given up searching for answers after 4 hours today. I hope someone is able to see something I've done that is just stupid.
I'm using a simple XMLHttpRequest to pass formdata. Appending key and value via for loop.
let _data = new FormData();
for (var key in req) {
var value = req[key];
_data.append(key, value);
}
Creating request, open and send
let xhr = new XMLHttpRequest();
xhr.open("POST", qb_url, true);
xhr.send(_data);
But the formdata is not appearing as valid key values when it hit the PHP page. I appear to get a array with one string encompassing everything, without the parsed key/value when I var_dump $_POST in PHP:
array(1) {
["------WebKitFormBoundaryI9nfSkkAwYNXDddt
Content-Disposition:_form-data;_name"]=>
string(173) ""i"
6
------WebKitFormBoundaryI9nfSkkAwYNXDddt
Content-Disposition: form-data; name="comprobante"
5.060308220031026e 49
------WebKitFormBoundaryI9nfSkkAwYNXDddt--
"
}
Similar/strange output in debugger in Chrome: https://drive.google.com/file/d/12IEDmctiYChcoeGgZjVPluZaGHotOu_t/view?usp=sharing
array(0) { } I am using xhr.setRequestHeader("content-type","application/x-www-form-urlencoded"); – Dave Playfair Aug 30 '22 at 20:59