Hi Robert,
Thanks for pointing me to the post above...
This is what I have so far,
fl.queryFeatureAttachments(feature).then(function(attachments){
console.log(attachments);
for (var x = 0, xl = attachments.length; x < xl; x++) {
console.log(attachments[x]);
var contentType = attachments[x].contentType;
var contentName = attachments[x].name;
var xhr = new XMLHttpRequest();
xhr.open("GET",attachments[x].url,true);
xhr.responseType = "arraybuffer";
xhr.onload = function(evt){
console.log(this.response);
var arrayBufferView = new Uint8Array( this.response );
var blob = new Blob([ arrayBufferView ], { type: contentType });
var formData = new FormData();
formData.append("method", "post")
formData.append("enctype", "multipart/form-data");
formData.append("attachment", blob, contentName);
console.log(formData);
esriRequest({
url: "https://services8.arcgis.com/[AGO]/arcgis/rest/services/[fl]/FeatureServer/0/[objectid]/addAttachmen...",
form: formData,
content: {
f: "json"},
handleAs: "json"
}).then(function (response){
console.log(response);
});
};
xhr.send(contentType,contentName);
};
});
but I am getting this error
dojo.js:412 Uncaught TypeError: d.slice is not a function
at Object.G [as isBlobProtocol] (dojo.js:412)
at dojo.js:452
at XMLHttpRequest.xhr.onload (gch.js:331)
Any ideas what this means?
Thanks James