Attachments with phonegap plugin


¿How Do I have to post a document (with phonegap plugin) with an attachment?, function(err, ok) {


The simplest way is to PUT the doc body first, then PUT the attachment afterwards. But this creates two revisions. To PUT the document including attachment(s) in one step, add an _attachments property containing the metadata and contents of each attachment.


Now I have another problem.
How I do get the attachments of a document?
When I get the document it says that it has two attachments (att1.png and att2.jpg). Then when I try to get the attachments I get a 404 error(Not found).
My code is:
config.db.get(url, function(error,attachment)){

where url is: d2023d49-6fd8-4571-aa12-20104326bdef/att1.png

(d2023d49-6fd8-4571-aa12-20104326bdef is the id of the document)

I really appreciate any help you can provide


I don’t know the JS API you’re using, but to get the attachment you just load that URL directly. I suspect db.get is just for loading documents.


I will ask at the phonegap forum