cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Setting content type of uploaded file using CURLFORM_CONTENTTYPE

From: Michael Wood <esiotrot_at_gmail.com>
Date: Tue, 12 Oct 2010 15:23:38 +0200

On 12 October 2010 12:18, Michael Wood <esiotrot_at_gmail.com> wrote:
> On 12 October 2010 11:58, Michael Wood <esiotrot_at_gmail.com> wrote:
>> Hi
>>
>> I'm using libcurl 7.19.7 on Ubuntu and I'm trying to set the content
>> type of an uploaded file using CURLFORM_CONTENTTYPE, but it does not
>> appear to be working.
>>
>> I've tried modifying the example postit2.c to add the content type to
>> application/octet-stream, but it still seems to be using text/plain.
>> I haven't tried a later version of libcurl yet and I will do that, but
>> am I doing something wrong?  I've had a look at the tests in git and I
>> don't see any that try to use CURLFORM_CONTENTTYPE.
>
> I've just tried it with version curl-7_21_1-172-gedf9566 (according to
> git describe --tags) and the results are the same.  Also, I tried
> specifying the file name using CURLFORM_FILENAME and that also seemed
> to be ignored.

OK sorry, I was misinterpreting the verbose output! The text/plain
was an answer from the server, not what was sent to the server.

The content type of the posted file is not printed by CURLOPT_VERBOSE,
but if I sniff the traffic I see it is set correctly.

Sorry for the noise.

-- 
Michael Wood <esiotrot_at_gmail.com>
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2010-10-12