Last updated: Oct 20 2016

Area: Episerver Service API Applies to versions: 1 and higher

Chunk upload of large files

EPiServer.ServiceApi allows for bulk operations, which upload files to be imported. ASP.net has a maximum limit of 2GB. Because allowing such large requests can be a security risk to your site, the service API lets you upload files in chunks to be used later for import.

Example model

Upload chunk

This method uploads large files to the service API in multiple chunks. It also can resume if the upload is interrupted. If an uploadId is not passed in, it creates a new upload identifier. If an offset is not passed in, it uses offset of 0.

Typical uses

  • Send a PUT request to episerverapi/commerce/upload/chunk with the first chunk of the file without setting uploadId, and receive an uploadId in return.
  • Repeatedly PUT subsequent chunks using the upload_id to identify the upload in progress and an offset representing the number of bytes transferred so far.
  • After the last chunk, POST to episerverapi/commerce/import/upload/commit to complete the upload.

Commit chunked upload

This method commits the chunked uploads associated with the upload identifier, and creates a whole file to be used in a separate import call. The default value overwrites the file if the completed file already exists on the server for this upload identifier. The method returns the upload identifier if the upload was successfully committed.

Do you have feedback on this documentation? Send an email to documentation@episerver.com. For development-related questions and discussions, refer to our Forums on https://world.episerver.com/forum/