Send binary data with IE 7's XmlHttpRequest
Ok, I'm reading the content of a local binary file with the method mentioned here: http://nagoon97.wordpress.com/2008/0...es-using-ajax/
Then I'm getting the data as a string where each character represents the binary value. I have successfully sent that string with Mozilla's XmlHttpRequest's sendAsBinary method, but IE 7's version doesn't have that method...
Using the send method almost works, the only problem is that binary content can be represented as the asciicode 0. This means that the string read by sent is cut off as soon as it is encountered. That means that the part before the first NULL character (asciicode = 0) is successfully sent to the server.
The solution I have made right now is to increment each character's asciicode on the client side by one and decrement them on the server before converting the character to the binary representation. The downside with this is that the size of the data sent between the client and server gets larger than the original filesize. Ex: 8kb file grows to ~12kb.
So my question is if anyone have a better solution?
what about base64 encoding?
it shouldn't add up too much to the image size
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)