Since Mozilla's btoa
and atob
aren't compatible with IE, Im using Nick Galbreath's solution that works across the board.
In my JS, I have this snippet:
reader.onload = function (e)
{
var base64str = e.target.result.split(';')[1].split(',')[1];
var binaryData = base64.decode(base64str);
// binaryData looks like: 3!1AQa"q2¡±B#$RÁb34rÑC%Sðáñcs5¢²&DTdE£t
// 6ÒUâeò³ÃÓuãóF'¤´ÄÔäô¥µÅÕåõVfv¦¶ÆÖæö7GWgw§·Ç×ç÷5!1AQaq"2¡±B#ÁRÑð
// 3$bárCScs4ñ%¢²&5ÂÒDT£dEU6teâò³ÃÓuãóF¤´ÄÔäô¥µÅÕåõVfv¦¶ÆÖæö'7GWgw
// §·ÇÿÚ?õTI%)$IJI$RIrÿ[múÙxÝ^«ÝKØrþk²ïÑûíGóß÷¿ÑþÄY«ÍÓ±×úN //...
// Is this even binary data?
Ajax.SendToHandler(binaryData);
}
How do I convert binaryData
, which is sent to my ashx derived IHttpHandler
as a string, into a bytes[]
array?
Ask me to clarify where needed!