0

i'm trying getting binary string of the files but as i can see i'm unable actually, why readAsDataUrl works while readAsBinaryString won't ?

I putted my code in jsbin any help appriciated thanks.

updated jsbin

1 Answer 1

1
img.src = e.target.result;

Dude, the "src" attribute of an image is a URL, not a string where every character is an int between 0 and 255 !!

You have to use ReadAsArrayBuffer() instead, and then the canvas API to render the ArrayBuffer you have into the context of a canvas.

Edit: If you don't want to show it in an image, but just to Ajax it to your server, here is a solution !

Sign up to request clarification or add additional context in comments.

1 Comment

hey buddy, i would like only to get binary string of the file and send it via ajax, how can i do that? :(

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.