Flex: send HTTP POST request with binary data in body

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

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

- Andreas

+2


source to share


4 answers


Place it using classes URLLoader

and URLRequest

.



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

      

+3


source


I have never used Flex, but I would assume that you would need to encode your binary data to ascii using something like http://en.wikipedia.org/wiki/Uuencoding



+1


source


True, Flex HTTPService does not support different enctypes. A good alternative that I found and use is ru.inspirit.net.MultipartURLLoader found at http://code.google.com/p/in-spirit/source/browse/#svn/trunk/projects/MultipartURLLoader/en / inspirit / net (MIT license). Works good!:)

+1


source


Depending on your purpose, you might consider using AMF objects. google "flex actionscript" which assumes you are running the server. Zend AMF is a pretty good PHP AMF implementation.

0


source







All Articles