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

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s