This demo application shows how to upload multiple files in several threads concurrently.


The application highlights the following features:

  • Asynchronous upload of files using several concurrent HTTP connections.
  • Automatic connection recovery.
  • Upload to several URLs.
  • Advanced details view.

To find information about how this demo is implemented using a specific platform, see the Samples by Platforms topic.

Note that concurrent upload and advanced details view are not yet supported in the Java version of Image Uploader. It will perform sequential upload and show standard progress dialog.

Client-Side Code

Upload Using Several Concurrent HTTP Connections

Sending several files in parallel reduces the total time of upload. To specify that the upload should be performed using a number of concurrent connections, change the MaxConnectionCount property. Its value sets the upper limit to the amount of HTTP threads (in this demo, 3).

You can also specify that the files should be sent to several servers to distribute the load between them. For that, add required URLs to the value of the Action property, as it can take a semicolon-separated list of URLs. In this sample, the same server and page are used for all cases, but you can specify addresses pointing to different servers. For more details about the concurrent upload, see the Uploading Files Sequentially and Concurrently topic.

Automatic connection recovery

Conditions for automatic connection recovery are specified using the AutoRecoverTimeOut and AutoRecoverMaxTriesCount properties. For more details about connection recovery, see the Configuring Automatic Upload Recovery topic.

Advanced Details View

Concurrent Upload sample, ActiveX
Figure 1. Advanced details view in the ActiveX version.

To specify the advanced details view, set the UploadView property to AdvancedDetails. The AdvancedDetailsPreviewThumbnailSize property is used to define the size of thumbnails in the list. For more details on this view mode, see the View Modes topic.

As this view provides its own progress bar for each image, the SilentMode is set to true, specifying that the standard progress bar should not be shown. See the Adding a Custom Progress Bar topic for more details about working with progress bars.

To stop all the uploads at once, the Stop button is provided. It is displayed when the upload is in progress and is hidden otherwise. Whether it should be displayed or hidden, it is determined in the BeforeUpload event handler.

Server-Side Code

To complete the upload started by Image Uploader, some actions on the server side should be performed. The upload script of this application is almost equivalent to the one of the Basic Demo Sample. The only difference is that now images are sent in several batches, and, therefore, only POST fields with index 1 (such as SourceFile_1, FileName_1, etc.) are used.