使用Flex同时上传多个文件 [英] Uploading multiple files simultaneously with Flex

查看:172
本文介绍了使用Flex同时上传多个文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



当文件被上传到一个队列(一个在一个队列中时间),但只要我试图让它一次上传2个文件,我遇到问题。

似乎文件往往会锁定,并留在1%,直到其他文件上传,或只是不完整。一次只能上传一个文件。



在Flex中一次调用多个文件的.upload有问题吗?

解决方案

不幸的是,每个主机的浏览器限制为2(取决于浏览器)活动连接。这意味着一次只有两个上传文件被激活,另一个上传文件将被排队。现在这通常不会真的成为一个问题,但是当上传的文件相当大时,其他上传将会超时,即使它们没有启动。每两个上传(upl1.mydomain.com,upl2.mydomain.com)使用子域名有一个解决方法,我没有去测试,但它应该做的伎俩。



<参考: http://anirudhs.chaosnet.org/blog/2008.06.17。 HTML (你可以从第一个链接实际得到)。

另外,您可能无法在Flash中将上传队列排队,因为安全模型需要(FileReference的)上传方法作为点击鼠标。


I have been working on a flex uploader, where the user can select multiple files.

It works fine when the files are uploaded in a queue (one at a time), however as soon as I try to have it upload 2 files at once I run into issues.

It seems that files will often lock up, and either stay at 1% until every other file is uploaded, or just not complete at all. There is never more than one file uploading at a time.

Is there some issue with calling .upload on multiple files at once in Flex?

解决方案

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.

这篇关于使用Flex同时上传多个文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆