Uploading multiple files simultaneously with Flex

你说的曾经没有我的故事 提交于 2019-11-30 07:50:32

Unfortunately it's a browser limitation of 2 (depending on browser) active connections per host. Meaning only 2 uploads will be active at a time, while the other will be queued. Now this normally wouldn't really be a problem but when the uploaded files are pretty large, the other uploads will time out, even though they didn't start. There's a workaround in using subdomains every 2 uploads (upl1.mydomain.com, upl2.mydomain.com) that I didn't get to test but it should do the trick.

References: http://anirudhs.chaosnet.org/blog/2008.06.17.html and http://www.ajaxperformance.com/2006/12/18/circumventing-browser-connection-limits-for-fun-and-profit/ (which you can get to from the first link actually).

Also, you probably won't be able to queue the uploads in flash, because the security model requires upload method (of the FileReference) to be called as a result of a mouse click.

Yoni

I don't have a direct answer to your question, but the gmail uploader comes to mind. It uses swfupload (updated link), which is open source so you can probably figure it out from the source.

There's more info in this answer.

Another way to simulate multitasking is downloading / uploading by chunks and use callLater() for sequential execution. That would be a replication of early Windows cooperative multitasking

The problem is with the model in which Flex connects to the back-end. With HttpService and Remoting, Flex clients opens a Http connection to the server. If you are connecting to the same Servlet / service on the server, it will use the same connection and can run into issues.

For a simple test, try create two instances of the same servlet and send upload requests to 2 servlets for 2 uploads. It should work.

Making the upload script as upload class may help.. i mean if your uploading script is in php or asp then make the class of that script so that each request corresponds to each unique object and we can upload files simultaneously...

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