https://stackoverflow.com/questions/7650587/using-javascript-to-display-a-blob The problem was that I had hexadecimal data that needed to be converted to binary before being base64encoded. in PHP: base64_encode(pack("H*", $subvalue))