cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: HTTP POST Memory...

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Wed, 19 Jun 2002 16:03:28 +0200 (MET DST)

On Wed, 19 Jun 2002, SHIRETU wrote:

> My form NEEDS a valid file (<INPUT TYPE="file" NAME="FileName">).

So don't simplify your needs then. You want this as a multipart formpost too,
right?

> I just asked you how to simulate one in memory, how to read from a buffer
> instead from a file(ex: char *, CString, etc).

And I asked you in what ways curl_formadd() doesn't answer your questions.

> Let me give you an example:
>
> CString str="This is the content of a file";
>
> When i pass the string str to MyPost(CString URL, CString
> data_to_be_posted) function I want to be interpreted as a binary file
> (with a generated name if necesary) by cURL library.

You want to make a multipart formpost, yes.

> You can say now: "So, write a file with that content and pass it to
> cURL!!!".

Yes I can, and it used to be the only way we provided an easy way to do it,
but now I can also say: Chris Combes is your friend, as he made it possible
to do "file uploads" using multipart formposts with curl_formadd() in curl
7.9.8.

Check the CURLFORM_BUFFER and associated options here:
        http://curl.haxx.se/libcurl/c/curl_formadd.html

-- 
    Daniel Stenberg -- curl groks URLs -- http://curl.haxx.se/
----------------------------------------------------------------------------
                   Bringing you mounds of caffeinated joy
                   >>>     http://thinkgeek.com/sf    <<<
Received on 2002-06-19