AnsweredAssumed Answered

FeatureLayer.AddAttachment() does not work properly

Question asked by thomaslaue on Nov 14, 2012
Latest reply on Jan 28, 2013 by harrisjm0101

I am currently working on a mobile solution using JQuery Mobile and ArcGIS JavaScript API. I have been developing my own attribute editor as the default ESRI attribute and attachment editor widgets do not match to our style guides. Everything is working so far apart from the attachment handling.

I have been trying adding attachments (mainly images) using the following piece of code:

if (featureayer.isEditable && featureayer.hasAttachments) {      featureayer.addAttachment(selectedFeatureObjectID, document.getElementById("addImageForm"), function (result) {                        ...     },     function (error) {                        ...     });

My application is trying to post the selected image to my local server and I can see the following post request payload using the Chrome developer tools:

Content-Disposition: form-data; name="inputFile"; filename="images.jpeg"
Content-Type: image/jpeg

Content-Disposition: form-data; name="token"

Content-Disposition: form-data; name="f"


However it is always getting back with an error message:

Error: Error performing add attachment operation
Code: 500

Unfortunately, I have no idea what might be the reason of this problem. I can add attachments using ArcGIS Desktop and the ArcGIS Server Rest API via Browser so that I am assuming that this is not a issue with my feature service.

Thank you very much for any hint! Best regards