Chunk Upload

You can use the Upload to split files into chunks and send them asynchronously through multiple requests to the server.

Setup

To enable file chunking, configure the chunkable option. It accepts both boolean and ChunkSettings parameters.

If you use a ChunkSettings parameter, the Upload enables you to specify the following options:

  • sizeDetermines the size of each chunk in bytes. The default value is 1048576 i.e. 1MB.
  • autoRetryAfterWill attempt a failed chunk upload after the specified number of milliseconds. The default value is 100.
  • maxAutoRetriesDetermines the number of attempts to retry uploading a failed chunk. The default value is 1.
  • resumableDetermines if the file upload process could be paused and later resumed. The default value is true.

If you use a boolean parameter and set the value to true, the component will apply the default ChunkSettings values.

Along with the uploaded file chunk, the FormData contains a JSON stringified ChunkMetadata object with the following information:

  • contentTypeThe MIME type of the file.
  • fileNameThe name of the file.
  • fileSizeThe size of the file.
  • fileUidThe unique identifier of the file.
  • chunkIndexThe index of the currently uploaded chunk.
  • totalChunksThe total number of chunks that the file is split in.

You can use this information to reconstruct the original file on the backend.

Example
View Source
Edit In Stackblitz  
Change Theme:

Sequential Chunk Upload

By default all files are uploaded concurrently. In order to upload the files one by one, set the concurrent option to false.

Example
View Source
Edit In Stackblitz  
Change Theme:

Disable Pause

In order to upload the files without allowing the user to pause the upload process, set the resumable option of the ChunkSettings parameter to false.

Example
View Source
Edit In Stackblitz  
Change Theme:

In this article

Not finding the help you need?