SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In one of my tasks,i was struck with one issue,that is "While uploading multiple files into document library with REST API".

Iam trying to upload multiple files in library with REST calls for an APP development,my issue is if i wants to upload 4 to 5 documents at once its storing only 3 documents and further giving "Conflict" error".below is the attached screenshot of exact error.

Error within screenshot are : status Code : 409 statusText :conflict I have searched many blogs but i didnt find any solution,can anyone please help me on this issue.

For this operation iam uploading different files as an attachment to an list item,below is the code used for uploading multiple files.

function PerformUpload(listName, fileName, listItem, fileData)
    var urlOfAttachment="";
    var itemId = listItem.get_id();

    urlOfAttachment = appWebUrl + "/_api/web/lists/GetByTitle('" + listName + "')/items(" + itemId + ")/AttachmentFiles/add(FileName='" + fileName + "')"
    // use the request executor (cross domain library) to perform the upload
    var reqExecutor = new SP.RequestExecutor(appWebUrl);
        url: urlOfAttachment,
        method: "POST",
        headers: {
            "Accept": "application/json; odata=verbose",
            "X-RequestDigest": digest              
        contentType: "application/json;odata=verbose",
        binaryStringRequestBody: true,
        body: fileData,
        success: function (x, y, z) {
        error: function (x, y, z) {

           // alert("Oooooops... it looks like something went wrong uploading your file.");


Thanks in advance, Naresh

enter image description here

EDIT: Same issue while trying to create a list item and then add attachments to it using custom form and ECMA script. Below is the error message body:

error Conflict undefined -2130575305, Microsoft.SharePoint.SPExceptionSave Conflict. Your changes conflict with those made concurrently by another user. If you want your changes to be applied, click Back in your Web browser, refresh the page, and resubmit your changes.

Interesting thing is this error occurs only when the file is in MBs. If the file size is less then it will work properly.

share|improve this question
I am also stuck with the same problem.My code is also similar to yours. Error while uploading files more than 1 mb size.Did you get a solution for this? – Unnie Mar 10 '14 at 8:48

The issue is that your POSTing another attachment before SharePoint is done processing the item with larger files. So when you try to perform another operation on the item (adding another attachment, etc) a race condition is is reached and SharePoint throws the error. When the attachment files are smaller, the process has time to complete before you start the next upload.

You need to find a way to check if the item has completed it's processing. One way of doing this might be to do a get and check the item's etag and ensure that it has incremented the correct number of times before sending another POST.

share|improve this answer
i have called the method to upload the 2nd file on the success event of the 1st file upload..but still i get this error. – Unnie Apr 1 '14 at 17:45
I understand. But SharePoint has not completed processing the changes to the SPListItem. And it's the SPListItem that is causing the race condition. Add some debug statements or use console.log to see the etag on the list item itself. This could also have soemthing to do with event receivers or WFs running on the item. But I promise you this is what is causing the issue. I've experienced it myself. – Robert Kaucher Apr 1 '14 at 17:51

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.