Hi All,
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
status Text :conflict
I have searched many blogs but I didn't 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 + "')"
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);
}
});
}
Thanks in advance,
Naresh
http://www.flickr.com/photos/112048958@N06/11461491596/[
^]