You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@couchdb.apache.org by "z.ohnami" <z....@gmail.com> on 2009/05/10 08:42:16 UTC

Adding jpeg Attachment

Hi.

I tested following command at couchdb 0.9.0.

 $curl -X PUT http://192.xxx.yyy.zzz/database/document/test.txt?rev=nnn
-H "Content/Type: text/plain" -d @test.txt

It worked well.I got the text data from Futon.
But next doesn't work well.I got file's URL from Futon instead of jpeg
data I PUT.

 $curl -X PUT http://192.xxx.yyy.zzz/database/document/test.jpg?rev=nnn
-H "Content/Type: image/jpeg" -d @test.jpg

Is my command wrong ?

Re: Adding jpeg Attachment

Posted by "z.ohnami" <z....@gmail.com>.
Hi,Matt.

I could !!
Thank you for your advise.

Re: Adding jpeg Attachment

Posted by Matt Goodall <ma...@gmail.com>.
2009/5/10 Matt Goodall <ma...@gmail.com>:
> 2009/5/10 z.ohnami <z....@gmail.com>:
>> Hi.
>>
>> I tested following command at couchdb 0.9.0.
>>
>>  $curl -X PUT http://192.xxx.yyy.zzz/database/document/test.txt?rev=nnn
>> -H "Content/Type: text/plain" -d @test.txt
>>
>> It worked well.I got the text data from Futon.
>> But next doesn't work well.I got file's URL from Futon instead of jpeg
>> data I PUT.
>>
>>  $curl -X PUT http://192.xxx.yyy.zzz/database/document/test.jpg?rev=nnn
>> -H "Content/Type: image/jpeg" -d @test.jpg
>>
>> Is my command wrong ?
>>
>
> The header should be Content-Type, not Content/Type.

Oh, and you also need to use --data-binary instead of -d if you're
sending binary data:

curl -X PUT http://192.xxx.yyy.zzz/database/document/test.jpg?rev=nnn
-H "Content-Type: image/jpeg" --data-binary @test.jpg

- Matt

Re: Adding jpeg Attachment

Posted by Matt Goodall <ma...@gmail.com>.
2009/5/10 z.ohnami <z....@gmail.com>:
> Hi.
>
> I tested following command at couchdb 0.9.0.
>
>  $curl -X PUT http://192.xxx.yyy.zzz/database/document/test.txt?rev=nnn
> -H "Content/Type: text/plain" -d @test.txt
>
> It worked well.I got the text data from Futon.
> But next doesn't work well.I got file's URL from Futon instead of jpeg
> data I PUT.
>
>  $curl -X PUT http://192.xxx.yyy.zzz/database/document/test.jpg?rev=nnn
> -H "Content/Type: image/jpeg" -d @test.jpg
>
> Is my command wrong ?
>

The header should be Content-Type, not Content/Type.

- Matt