We're having troubles adding an attachment to a GDB Feature Service Table. An "unknown error" is being shown, The GDB attachments are enabled. Don't know how to fix it!
Please contact Esri support to have them help you troubleshoot. It appears you are on the right track code-wise. The Attachment editor sample might be good to reference from our QML Sample Application.