SPUpload – Sharepoint JQuery Lib for Uploading files to Document Libraries

Standard

Github link

SPUpload is a JQuery library that uploads documents easily to sharepoint libraries using the REST API. It also Utilises JQuery Promises.

It works through the html file input.

Getting Started

Just include SPUpload.js into your Assets Folder and reference it in your code.

Simply Upload a Document as Follows

$(selector).SPUpload(options)

Default Options

webURL : _spPageContextInfo.webAbsoluteUrl,
docLibrary : 'Documents',
folderName : '',
fileName : ''

The Success and failure can be check as follows

$(selector).SPUpload(options).done(function(){
    //arguments variable according to the number of files available
    argument.forEach(function(item) {
        // do something with item
});
}).fail(function(jqXHR,error, errorThrown){
  // do something with the error
});
Advertisements