Resume upload

From Sense/Net Wiki
Jump to: navigation, search
  • 100%
  • 6.3.1 Patch 4
  • Enterprise
  • Community
  • Planned


Upload action
Uploading files to Sense/Net ECM Content Repository is easy: we provide a simple user interface where you may open a file picker to select one or more documents on your file system to upload, or you may simply drag and drop the files to the browser. This feature can handle even large files, as the data is uploaded to the server in chunks. But if something happens during a long-running upload operation (e.g. the browser window gets closed or the operating system shuts down), it would be nice to be able to continue (resume) the upload process where we left off. This article describes how this is done in Sense/Net ECM.

Resumable interrupted uploads

We provide upload resume functionality for our users and an API for developers that they can use control how file upload works in a custom UI environment.

User interface

When a long-running file upload operation gets interrupted, the file will remain in an interim state, and only the previously finalized version will be accessible (e.g. the last major approved version). The content will be marked with a special icon in the list, so that you can find these kinds of files easily:

Not finalized file

If you decide that you do not need the changes, you may choose the Undo changes menu item from the action menu of the document. But if you want to continue uploading the document, you may select the Resume upload menu item to continue uploading the file.

Resume upload

On this dialog window you will need to select the file again from your file system. You will see a progress bar that shows how much of the file was uploaded before.

Resume upload dialog


This is a light-weight feature that builds on client-side technologies. This means that if an upload was interrupted, it can be resumed only in the following cases:

  • only in the same browser (you cannot start an upload in Chrome and finish it in Internet Explorer)
  • only on the same machine (you cannot start an upload on a work machine and continue it from home)
  • only by the same user (you will be able to continue uploading files only in the name of a user who started the upload process)
  • only with Resume Upload action (you cannot continue the upload with the default 'Upload' action)

Client-side API

The necessary Javascript methods can be found in the following file:

  • /Root/Global/scripts/sn/SN.Upload.js

Resumable files

When an upload operation is in progress, we store the number of bytes that were successfully uploaded. This is the position where the upload operation may be resumed after an unwanted break. The API offers the following method that can be used by 3rd party developers who created a custom upload mechanism. You will need to call this method every time a chunk was successfully uploaded to the portal to let the client-side storage track uploads:

SN.Upload.setResumeProgress(data.formData, parentPath, parentId, data.loaded, user);

The parameters are the following:

  • formData: JSON object containing all the properties that were used during the upload
  • parentPath: content path of the container
  • parentId: content id of the container
  • offset: number of successfully uploaded bytes
  • size: original file size
  • fname: name of the file
  • maxChunk: maximum chuncksize
  • user: domain\username of the user who initiated the upload

Developers may use our upload API to get a list of all the files that are in the middle of a Multistep saving operation and build a custom UI for resuming files.

As resumable files always belong to a certain user, all the methods below expect a username parameter (meaning a full user name that contains a domain name too, like 'BuiltIn\Admin').

To get all resumable files, call the following method:

var files = SN.Upload.getResumableFiles(userName);

If you want to have a list of resumable files in a particular subtree, you may call this function with a container path.

var files = SN.Upload.getResumableFilesBySubtree("/Root/MyUploadFolder", userName);

If you want to have a list of resumable files in a particular folder (only children), you may call this function with a container id.

var files = SN.Upload.getResumableFilesByParentId(123456);

Continue uploading files

You can use the JSON object provided by the methods above to continue the upload operation. We recommend using the jQuery File Upload plugin for uploading chunks of files to the Content Repository. Please take a look at the Upload action article for details about uploading files from client side.

The difference between the simple upload and resume upload function that you have to add the parameter 'uploadedBytes' and add the resume item's offset to it as a value. So the file upload process will continue from the part of a file where it was aborted. You also have to call the submit method on data to start the upload again.

        add: function(e, data)
            data.uploadedBytes = resumeItem.offset;
            uploaddata = data;
   $('#file-upload-submit-button').on('click', function(){
        uploaddata.formData = {
            "FileName": filename,
            "Overwrite": true,
            "ContentType": 'Auto',
            "ChunkToken": resumeItem.chunkToken,
            "PropertyName": "Binary"


To make sure that the uploaded documents are handled in a safe way and the system cannot be compromised, we do not store any sensitive information on the client side. Although the local data (stored in the browser's local storage) can be altered, it is absolutely not possible to make unwanted changes on the portal, because we always authenticate users and authorize requests during the chunk saving operation.

Related links