Dear @JustinArias and @dmorrow,
Would you please help me at this? I have issue when use this code to attach a file:
var fileToUpload = document.getElementById(“testfile”).files[0];
var data = {“file”: fileToUpload , “comment”:“test attachment”, “minorEdit”: “true”};
AP.request({
url: “/rest/api/content/18415730/child/attachment”,
type: “POST”,
data: data,
contentType: “multipart/form-data”,
headers: {
“X-Atlassian-Token”: “nocheck”,
“Accept”: “application/json”
},
success: function (data){
return data;
},
error: function(jqXHR, textStatus, errorThrown){
//return deferred.reject(jqXHR.responseText);
}
});
An the error returns:
I can use curl command to attach successfully. Would you please let me know how to fix this issue?
Thanks!!!