I have a feature service that contains a number of features for which I want to allow the attaching of files/images etc. The layer is editable and it has attachments enabled, both as a property on the layer and as an attachment table in arcmap. The code to attach the file/image is as follows:

             layer.addAttachment(featureOBJECTID, document.getElementById("attachmentUploader"), callback, function (err) { });

The element being passed is the form:

<form id="attachmentUploader" style="display: inline-flex; margin-top:10px;">Add:&nbsp;&nbsp;<input type="file" name="attachment'" onchange="uploadAttachmentFeature()"><input type="hidden" name="f" value="json"></form>

This used to work up until around last October, however it had suddenly stopped working and I had found a thread that said that the issue was with arcgis server 10.2. The server was just upgraded to 10.6, however the issue is persisting with the following error:

Error: Error performing add attachment operation
at Object.e.load (init.js:1005)
at init.js:87
at c (init.js:103)
at d (init.js:103)
at b.Deferred.resolve.callback (init.js:105)
at c (init.js:104)
at d (init.js:103)
at b.Deferred.resolve.callback (init.js:105)
at init.js:92
at l (init.js:107)

An error is also being shown in the arcgis server logs saying that the attachment process was not successful.

Is there any solution for this issue?

EDIT - When accessing the add attachment service from within the url the file attaches fine from the add attachment window in the service itself.

  • did you tried to attach images via your service's rest endpoint ? – AhammadaliPK Apr 12 '18 at 20:54
  • If you mean directly via the service then that works, it's when I call the process through the js code that the issue occurs – Maeglin77 Apr 16 '18 at 10:05
  • okay , could you please compare both request ? compare request going via js code with request which is going via REST – AhammadaliPK Apr 16 '18 at 10:19
  • or you can chat with me if you want – AhammadaliPK Apr 16 '18 at 10:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.