Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Uploading multiple files simultaneously with Flex

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?

like image 745
David Avatar asked Nov 06 '22 16:11

David


1 Answers

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.

like image 149
bug-a-lot Avatar answered Nov 08 '22 13:11

bug-a-lot