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);
reqExecutor.executeAsync({
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) {
alert("Success!");
},
error: function (x, y, z) {
alert(z);
// alert("Oooooops... it looks like something went wrong uploading your file.");
}
});
}
Thanks in advance, Naresh

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.