src/Templates/App/services/spFormFactory.js
function addFileToFolder(arrayBuffer) {
            // Construct the endpoint.
            var fileCollectionEndpoint = String.format(spFormFactory.getFileEndpointUri(_spPageContextInfo.webAbsoluteUrl, doclibname, foldername) + "/add(overwrite=true, url='{0}')", fileuniquename);

            // Send the request and return the response.
            // This call returns the SharePoint file.

            return jQuery.ajax({
                        url: fileCollectionEndpoint,
                        type: "POST",
                        data: arrayBuffer,
                        processData: false,
                        headers: {
                            "accept": "application/json;odata=verbose",
                            "X-RequestDigest": $("#__REQUESTDIGEST").val()
                            //,"content-length": arrayBuffer.byteLength
                        }
                    });
        }
function addFileToFolder(arrayBuffer) {
            // Construct the endpoint.
            var fileCollectionEndpoint = String.format(spFormFactory.getFileEndpointUri(_spPageContextInfo.webAbsoluteUrl, doclibname, foldername) + "/add(overwrite=true, url='{0}')", fileuniquename);

            // Send the request and return the response.
            // This call returns the SharePoint file.

            return jQuery.ajax({
                        url: fileCollectionEndpoint,
                        type: "POST",
                        data: arrayBuffer,
                        processData: false,
                        headers: {
                            "accept": "application/json;odata=verbose",
                            "X-RequestDigest": $("#__REQUESTDIGEST").val()
                            //,"content-length": arrayBuffer.byteLength
                        }
                    });
        }
function addFileToFolder ( arrayBuffer ) { // Construct the endpoint. var fileCollectionEndpoint = String . format ( spFormFactory . getFileEndpointUri ( _spPageContextInfo . webAbsoluteUrl , doclibname , foldername ) + "/add(overwrite=true, url='{0}')" , fileuniquename ) ; // Send the request and return the response. // This call returns the SharePoint file. return jQuery . ajax ( { url : fileCollectionEndpoint , type : "POST" , data : arrayBuffer , processData : false , headers : { "accept" : "application/json;odata=verbose" , "X-RequestDigest" : $ ( "#__REQUESTDIGEST" ) . val ( ) //,"content-length": arrayBuffer.byteLength } } ) ; }
}, onError); Add the file to the file collection in the Shared Documents folder.
} onError ) ; Add the file to the file collection in the Shared Documents folder .