Select to view content in your preferred language

FeatureLayer.AddAttachment() does not work properly

7921
10
Jump to solution
11-14-2012 06:31 AM
ThomasLaue
Emerging Contributor
Hello,

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:

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


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

B8rm1jrQR_Vh0VMZQ1EJ17IXpM284A3C3VmJHvoQC5w19hU5UwuU5TKseEAZTWP8NgaOOjV_4kJRJajyfKtCRw..
------WebKitFormBoundaryqLUYc2Wu8g9s28A1
Content-Disposition: form-data; name="f"

json
------WebKitFormBoundaryqLUYc2Wu8g9s28A1--

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

Thomas
10 Replies
ShreyasVakil
Frequent Contributor
Hi Shreyas,

Are you aware of any change in attachment option in 10.1, the reason I am asking this is as follows:
I am trying to upload a image from iOS 5 device to ArcGIS Feature service with help of picup (http://picupapp.com/).
With ArcGIS Server 10, I am able to add attachment however, when I point to same service published on ArcGIS Server 10.1 it does not work. 

I am attaching the http request captured from wireshark for your reference. I do not see any difference between them but if you have any inputs some direction to solve this please share it with me.

[ATTACH=CONFIG]21133[/ATTACH]
[ATTACH=CONFIG]21134[/ATTACH]

Thanks,
Rahul


I never worked on http://picupapp.com/ ,so I cannot really comment on this one.

There was a new parameter added called as gdbVersion at 10.1 for addAttachment operation, but I don't think anything else changed.
0 Kudos