I am using this javascript code to read and upload a file to server:
var reader = new FileReader();
reader.onloadend = function() {
var bytes = reader.result;
var ext = file.name.split(".").pop();
xhr.send("bytes="+bytes+"&type="+ext);
}
reader.readAsDataURL(file);
When I check which parameters are being sent to server (in the developer console), I see this:
https://i.sstatic.net/8Yrdp.jpg
which causes an Illegal base64 character error (I think caused by the spaces in the string).
Anyone knows how to fix that?
readAsBinaryStringrather?btoato convert it afterwards. It's just an idea you could try ^^java.lang.IllegalArgumentException: Illegal base64 character 20) and the same spaces being shown in the string.