function saveNewFeature()
{
var reader = new FileReader();
var file = inputphoto.files[0];
reader.addEventListener('load', function (event) {
var newFeature = ({
attributes: {
"brochure": inputBrochure.value,
"meterNumber": inputmeterNumber.value,
"materialIn": inputmaterialIn.value,
"materialOut": inputmaterialOut.value,
"dateCreated": inputdateCreated.value,
"svNumber": inputsvNumber.value,
"address": selectedFeature.graphic.attributes.USPS_LSN,
"scheduledAppoint": inputscheduledAppoint.value,
"notes": inputnotes.value
},
geometry: selectedFeature.graphic.geometry,
attachments: [{
name: file.name,
contentType: file.type,
data: event.target.result
}]
});
console.log(newFeature)
globalMaterial.applyEdits({
addFeatures: [newFeature]
}).then(function (results) {
globalMaterial.applyEdits({
addAttachments: [newFeature]
}).then(function (results) {
console.log(results)
});
});
});
reader.readAsArrayBuffer(file);
}
Forgive me I'm new to arcgis js library. Trying to create a new feature with an existing geometry and attributes. The feature is successfully created but the attachment is left empty. I can add it through AGOL. Any suggestions?