Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Identifying the nature of data encoded by FileReference object in Flex for a PNG image

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:

enter image description here

The data of my request, which reads the PNG using Filereader.readAsBinaryString(), looks like this:

enter image description here

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?

like image 655
vettipayyan Avatar asked Aug 15 '19 14:08

vettipayyan


1 Answers

I found the solution. I tried the FileReader.readAsArrayBuffer to read the data. It accomplishes what Flex does.

like image 126
vettipayyan Avatar answered Nov 07 '22 19:11

vettipayyan