Aurigma HTML5/Flash Uploader 8.5.55
Sending File at Once or in Several Parts in HTML5/Flash Uploader
Flash Uploader allows uploading files in the following modes:
Each mode has advantages and disadvantages. Let us examine all of them in detail.
This is default mode. To make Flash Uploader send a file in a single request, set the UploadSettings.ChunkSize to 0.
In this mode every request being sent within an upload session contains all converted files created for one user-selected file. Flash Uploader prepares a POST request containing converted files and metadata and then submits this request (package) to the server. After that Flash Uploader waits for a confirmation of a successful upload of this package; when this confirmation is received, the next package is uploaded in the same manner. This procedure is repeated until all the user-selected files are uploaded. The next figure illustrates this mode.
Figure 1. Uploading a file in a single request.
To configure the chunk upload mode, set the ChunkSize to a positive integer (number of bytes allowed to upload within a request).
Here Flash Uploader restricts the POST request by size. It means that every request being sent within an upload session cannot contain more than ChunkSize bytes of binary data. When Flash Uploader works in this mode it adds converted files and metadata to a POST request until the request length exceeds ChunkSize + metadata size bytes. If the last added file does not meet the chunk size limitation, Flash Uploader adds just a portion of this file to complete this chunk. The remaining portion will be added at the beginning of the next chunk. After that this request (chunk) is submitted to the server, and Flash Uploader waits for a confirmation of a successful upload of this chunk. When this confirmation is received, the next chunk is uploaded in the same manner. The figure below demonstrates the chunk upload mode.
Figure 2. Uploading in several chunks.
In the case of chunk upload mode converted files created for different user-selected files will be sent in separate requests even though they may fit in one chunk.
- Total time of upload. Upload consists of three stages: establishing a connection, upload itself, and waiting for a confirmation of success. If a file is sent in a single request Flash Uploader performs connection initialization and finalization as many times as files selected to upload, whereas in the chunk upload mode these actions are repeated for every request. That is why sequential upload in several parts has some time overhead in comparison to the former one. However, usually this difference is not big enough to be noticed.
Server-side limitations. The majority of web servers have limitations for maximum POST request length and script execution timeout. These limitations may cause the upload problem when the currently uploading request exceeds a maximum allowable length or the upload processing script works too long. Increasing these limitations is rather unsafe because it becomes easier to overload the server. That is why upload in parts may help. Thus, if it is expected that your users will upload large size file, we recommended to turn chunk upload mode on.
- Upload script logic. Uploading files in multiple parts significantly complicates the logic of the upload processing script. In chunk upload mode you should bundle portions of files uploaded in separate requests. However, HTML5/Flash Uploader ASP.NET and HTML5/Flash Uploader PHP provide classes which allow operating with files sent in any considered here upload mode.