Flex: Send HTTP POST request with binary data in b

2019-02-19 21:14发布

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

标签: flex http post
4条回答
做个烂人
2楼-- · 2019-02-19 21:44

Depending on your goal, you may want to consider using AMF objects. google "flex actionscript" that assumes that you control the server. Zend AMF is a pretty good PHP AMF implementation.

查看更多
SAY GOODBYE
3楼-- · 2019-02-19 21:54

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);
查看更多
Summer. ? 凉城
4楼-- · 2019-02-19 21:54

I've never used Flex but I would imagine you would need to encode your binary data in ascii using something like http://en.wikipedia.org/wiki/Uuencoding

查看更多
ゆ 、 Hurt°
5楼-- · 2019-02-19 22:08

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

查看更多
登录 后发表回答