cURL / Mailing Lists / curl-library / Single Mail

curl-library

Upload Form Data From Buffer

From: Combes, Chris M. <ccombes_at_northropgrumman.com>
Date: Fri, 07 Jun 2002 16:48:40 -0400

Developers,

I've been working on a new "formadd" option to libcurl which allows the
user to upload data similar to CURLFORM_FILE, but uses an
existing buffer as the data source.

Here is what the interface looks like:

curl_status = curl_formadd(&post, &last,
                           CURLFORM_COPYNAME, "record",
                           CURLFORM_BUFFER, "data",
                           CURLFORM_BUFFERPTR, record_buffer,
                           CURLFORM_BUFFERLENGTH, size,
                           CURLFORM_END);

CURLFORM_BUFFER indicates that we want to add data from a buffer,
and triggers the addition of the "filename" attribute set to "data".

CURLFORM_BUFFERPTR points to the existing buffer.

CURLFORM_BUFFERLENGTH is the size of the buffer.

I ran several tests using ascii and image data with positive results.

This is the first contribution I've made to an open source project
so I will need to read up on how to incorporate the changes via SourceForge.

Any comments appreciated,
Chris

_______________________________________________________________

Don't miss the 2002 Sprint PCS Application Developer's Conference
August 25-28 in Las Vegas - http://devcon.sprintpcs.com/adp/index.cfm?source=osdntextlink
Received on 2002-06-09