June 17, 2008 2:32 PM
Modern browsers impose limits on the number of connections opened to a particular host. This affects ajax calls and more interestingly, file uploads in flash / flex: Multiple uploads get queued up based on these connection limits.

File upload is easily done in Flash / Flex via FileReference. Multiple file upload means multiple calls to upload() for each FileReference object. Each upload() call will result in a separate HTTP request on the server side. These uploads will happen in parallel till you hit the connection number limit. In Firefox 2 and IE 7, upto two connections can be opened to each host. This means that if you call upload() on 4 files, though you will get the OPEN event1 for all 4 files, upload of the third and fourth will get queued till one of the earlier uploads finish. An interesting fact to note that the delay introduced here is not part of the normal browser request timeout calculation.

However, this impacts any timeout calculation you may attempt to perform on the flex side based on the OPEN event. The only way to confirm that the upload has actually begun is when you get the first PROGRESS event.

A possible way to get around this connection limit is by using CNAMES.

flex888 has a useful resource on Flex file uploads.

CategoryFlex Comment(s)

[1] Documentation for FileReference says that the OPEN event is dispatched when upload of a file has started. The more accurate statement would be that OPEN event is dispatched when the upload request is passed on to the browser. The browser may choose to internally queue this request.

Copyright © 2004-2011 Anirudh Sasikumar. All rights reserved.
Last Updated: June 17, 2008 5:19 PM