Note that there are some explanatory texts on larger screens.

plurals
  1. POCreating a couchdb standalone attachment using cURL
    primarykey
    data
    text
    <p>I am currently playing with couchdb and testing out the 'standalone attachments' feature, which is described near the bottom of <a href="http://wiki.apache.org/couchdb/HTTP_Document_API" rel="noreferrer">this page</a>.</p> <p>I am trying to use curl's --data-urlencode feature to send the creation request, which only half works. I can create the attachment and retrieve it, but the Content-Type field is wrong, so the image won't display correctly.</p> <p>To be more accurate CouchDB seems to work by returning the attachment using the same Content-Type it was posted in. (which is perfectly sensible IMO) My problem is curl doesn't send the correct code. Here's the details;</p> <pre><code> 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) &gt; PUT /dafttest/666/attachment HTTP/1.1 &gt; User-Agent: curl/7.19.4 (x86_64-pc-linux-gnu) libcurl/7.19.4 OpenSSL/0.9.8k zlib/1.2.3 &gt; Host: localhost:5984 &gt; Accept: */* &gt; Content-Length: 495389 &gt; Content-Type: application/x-www-form-urlencoded &gt; Expect: 100-continue &gt; </code></pre> <p>So the short version of this question is; how to I get cURL to send the correct Content-Type ?</p> <p>EDIT:</p> <p>I release that my other mistake was to use --data-urlencode, when to get it to work I need to use --data binary @filename together with the -H option that Dale suggested.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload