cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: HTTPPOST is not working with servlet

From: Shirish Kulkarni <shirishgk7_at_gmail.com>
Date: Fri, 26 Sep 2008 17:25:55 +0530

Thanks Linus.

(I have confused lot of people by saying "one parameter". Apologies..)
On Fri, Sep 26, 2008 at 4:47 PM, Linus Nielsen Feltzing <linus_at_haxx.se>wrote:

> Shirish Kulkarni wrote:
>
>> I just tried an example (multi-post.c) given in documentation and used a
>> servlet. CURLOPT_POSTFIEDS works perfectly with servlet, but it has a
>> limitation that only one parameter can be passed at a time and also it could
>> not be used if I wanted to do an operation like uploading a file.
>> This doesn't seem to be working with servlets. Any pointers as what's the
>> proper way or if I'm missing something would be highly appreciated.
>>
>
> I think you have to be more specific than this in your problem description.
> If your servlet handles file uploading, then it must support multipart POST.
> As far as I can see, there is no restriction in the Servlet architecture
> that prevents you from using multipart POST, you just have to parse the MIME
> data yourself.
>
> Also, CURLOPT_POSTFIELDS is not restricted to one POST field, you are
> supposed to pass the entire POST data like this:
>
> curl_setopt(ch, CURLOPT_POSTFIELDS,
> "name=Linus&Occupation=Clown&Stupid=yes");
>
> Linus
>
>
>
Received on 2008-09-26