I am trying to migrate a Flex based application to JavaScript and came across a file upload functionality which sends a PNG image to server. I don't have access to server code, so I am trying to mimic the Request made by the flex application. The data of request sent by flex application looks like this:
The data of my request, which reads the PNG using Filereader.readAsBinaryString(), looks like this:
As you can see, the flex application does some encoding which I couldn't figure it out. Although both of the contents look same, there are some minor differences, confirmed by the content length of each. AS3 FileReference documentation indicates it transforms the file content to a ByteArray using the load() function . Can somebody explain how they are encoding it?
I found the solution. I tried the FileReader.readAsArrayBuffer to read the data. It accomplishes what Flex does.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With