I'm presently having fun with couchdb and trying out the 'standalone attachments' feature, that is referred to near the foot of this page.
I'm attempting to use curl's --data-urlencode feature to transmit the creation request, which only half works; I can make the attachment and retrieve it, however the Content-Type area is wrong, therefore the image will not display properly.
To become better CouchDB appears to operate by coming back the attachment utilizing the same Content-Types was published in. (that is perfectly sensible IMO) My issue is curl does not send the right code. Here's the particulars
curl -vX PUT http://localhost:5984/dafttest/666/attachment --data-urlencode image/jpeg@xi_on_beach.jpg * About to connect() to localhost port 5984 (#0) * Trying 127.0.0.1... connected * Connected to localhost (127.0.0.1) port 5984 (#0) > PUT /dafttest/666/attachment HTTP/1.1 > User-Agent: curl/7.19.4 (x86_64-pc-linux-gnu) libcurl/7.19.4 OpenSSL/0.9.8k zlib/1.2.3 > Host: localhost:5984 > Accept: */* > Content-Length: 495389 > Content-Type: application/x-www-form-urlencoded > Expect: 100-continue >
Therefore the short version of the question is how you can I recieve cURL to transmit the right Content-Type ?
I release that my other mistake ended up being to use --data-urlencode, when to have it to operate I have to use --data binary @filename along with the -H option that Dale recommended.