Uploading multiple files simultaneously with Flex

前端 未结 5 855
时光说笑
时光说笑 2020-12-30 16:05

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 so

相关标签:
5条回答
  • 2020-12-30 16:09

    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.

    0 讨论(0)
  • 2020-12-30 16:16

    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

    0 讨论(0)
  • 2020-12-30 16:22

    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.

    0 讨论(0)
  • 2020-12-30 16:25

    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.

    0 讨论(0)
  • 2020-12-30 16:30

    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...

    0 讨论(0)
提交回复
热议问题