Flex: Send HTTP POST request with binary data in body

apache-flexhttppost

I'm new to Flex and couldn't figure out yet how to send binary data to the server as the body of a POST request. The HTTPService component doesn't seem to support this. The FileReference doesn't seem to support setting the data via the Flex API.

Unfortunately the answers to similar questions on stackoverflow.com haven't been very promising. Any new pointers would be greatly appreciated, thanks a lot!

— Andreas

Best Answer

Post it using the URLLoader and URLRequest classes.

var urlLoader:URLLoader = new URLLoader();
var request:URLRequest = new URLRequest(url);
request.data = binaryData;
request.method = URLRequestMethod.POST
urlLoader.load(request);