cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: CURLFORM_BUFFER vs CURLFORM_PTR

From: Mohun Biswas <m_biswas_at_mailinator.com>
Date: Wed, 30 Aug 2006 08:35:55 -0400

Daniel Stenberg wrote:
> On Wed, 30 Aug 2006, Mohun Biswas wrote:
>
>> I'm a little confused about the differences between CURLFORM_BUFFER*
>> and CURLFORM_PTR*. I'm currently using CURLFORM_PTRNAME,
>> CURLFORM_PTRCONTENTS, and CURLFORM_CONTENTSLENGTH to make multipart
>> forms and it seems to be working fine. What's the difference between
>> that and CURLFORM_BUFFER/CURLFORM_BUFFERPTR/CURLFORM_BUFFERLENGTH?
>
> The *BUFFER* ones are for making a CURLFORM_FILE part but instead of
> getting the file from disk, providing the data in a buffer.

Thanks but that's the source of the confusion because I seem to be
making file upload parts fine using the *PTR* options. The doc for
CURLFORM_BUFFER says "The given string is used as the value of the file
name field ..." while CURLFORM_PTRNAME says "... followed by a string is
used for the name of this part." Thus each of these provides a name,
and each comes with a way to specify the start of the buffer and its length.

So assuming the contents of a file have been read into a buffer, how is
a file upload part prepared with *PTR* different from one using
*BUFFER*? Sorry if I'm being dense.

Thanks,
MB
Received on 2006-08-30