I need to encode .zip file in base64 format on client side and send it on server (php). But, i cannot find any solutions for that in javascript.
i try this:
let zipFile = document.getElementById('fileReciever').files[0];
let formData = new FormData();
formData.append('id', btoa('7804044924'));
formData.append('data', btoa(zipFile));
let req = new XMLHttpRequest();
req.open("POST", 'http://localhost/xmlReader/reciever.php');
req.send(formData);
But in this way i getting just bse64 string in $_POST in filed 'data' on server, what converts by base64_decode in string "[object File]", and i getting nothing in $_FILES. How can correct convert .zip data file to base64 string in javascript and send it on server?