Uploading data with Flex and getting the bytes sent

*爱你&永不变心* 提交于 2019-12-11 06:05:26

问题


I want to upload data (not a local file) with Flex (4.1), and show what the progress is of the bytes sent.

Now I use a URLLoader, but I know that URLLoader was designed to download data, I can connect a listener to ProgressEvent.PROGRESS but that has no effect.

I also know there is a FileReference object which supports uploading. The problem here is, I do not want to browse for a file and upload it. I have a byte array which I want to send to the server, but the data property of FileReference is read-only.

So my question is: How can I send the byte array (which is actually a PNG encoded image) to the server and be able to track the progress of the bytes sent to server?


回答1:


Yes, you are right that the data property of FileReference is read-only, but you can track the progress.

If you want to use the URLLoader to upload data, you can try the uploadposthelp class.

You may have a look on the following site: http://labs.findsubstance.com/2008/04/03/as3-upload-encode-images/



来源:https://stackoverflow.com/questions/4114043/uploading-data-with-flex-and-getting-the-bytes-sent

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!