couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Justin Walgran" <>
Subject Uploading a file from an html form to a CouchDB attachment
Date Sun, 16 Nov 2008 15:46:26 GMT
I have been puzzling over the best way to upload a file from an HTML
form and have it end up as an attachment to a new CouchDB document.

Here is what I would like to do:

1) User select file using a "file" form element
2) User clicks the submit button
3) New CouchDB doc is created
4) Selected document is POSTed as an attachment to the new CouchDB doc

One snag is the fact that jquery.couch.DB.saveDoc does not not return
the autogenerated doc id, which makes it impossible to generate the
attachment url.

The bigger snag is the chaining of the two POSTs together. Based on my
preliminary Googling It does not appear possible to trigger a file
upload from javascript.

Has anyone tackled this?

- Justin Walgran

View raw message