1

I'm developing a provider hosted app that allows the user to upload files to document library on the app web, this means I have to use SP.RequestExecutor.js

I did finished the code and it works for small files <10MB but with larger files it hangs the browser and even crash after a while.

Is there any other way I can upload files using REST in provider hosted applications

here is the code I use

    $.getScript(hostweburl + "/_layouts/15/SP.RequestExecutor.js", function() {
executor.executeAsync({
    url: appweburl + "/_api/web/GetFolderByServerRelativeUrl('docs')/RootFolder/Files/Add(url='" + file.name + "')",
    method: "POST",
    headers: {
        "accept": "application/json;odata=verbose",
        "X-RequestDigest": digest,
    },
    binaryStringRequestBody: true,
    body: contents2,
    success: onSuccess,
    error: onFail,
    state: "Update"
});

});

  • Since you have provider-hosted app, can't you just do this with C# and CSOM? Also, since you have 365 have you looked at StartUpload? – eirikb Nov 25 '14 at 22:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.