Attachment Content Type is Incorrect When Adding to FeatureService

726
2
12-12-2018 09:40 AM
KeithLarson1
MVP Alum

Hello all,

I making a QML application where the user can interact with Attachments. Attachments can be added, updated, or deleted. Everything works as expected when I am working with attachments in a .geodatabase file on the device. However, when I try to add or update Attachments on the online geodatabase, the Attachments are added or updated with incorrect values in the CONTENT_TYPE and ATT_NAME columns in the attachment table. I am trying to store all attachments with a content type of "application/octet-stream", but when I upload a .jpg as an attachment, it is stored as "image/jpeg". Also, the attachment name is being automatically set to the file name which is the behavior I want, but I am unable to manually set a name, which I can do when connected to the .geodatabase file.

I am using the addAttachment() and updateAttachmentWithIndex() tasks to add and update the attachments (for example: attachments.addAttachment(url, "application/octet-stream, fileName");). I am using the same code for the online geodatabase and the.geodatabase file, but they are giving different results. Also, when I sync the .geodatabase file to the online geodatabase, the data is transferred over properly. 

Does anyone know what I may be doing wrong?

Thanks,

Keith

0 Kudos
2 Replies
LucasDanzinger
Esri Frequent Contributor

As far as I can see, it seems like this is not exposed on the feature service REST interface. I'm looking into why there are differences. Will let you know if I am able to track anything useful down.

0 Kudos
LucasDanzinger
Esri Frequent Contributor

My mistake - I do see it now - Attachment (Feature Service)—ArcGIS REST API: Services Directory | ArcGIS for Developers 

If you are seeing incorrect behavior where the wrong MIME type is used, I'd suggest logging a bug with Esri support, as the behavior you explain is not expected - https://support.esri.com/en/contact-tech-support 

0 Kudos