cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: How can I upload a string?

From: Dan Fandrich <dan_at_coneharvesters.com>
Date: Thu, 11 Dec 2008 10:11:34 -0800

On Thu, Dec 11, 2008 at 12:50:02PM +0100, Thorsten Schanno wrote:
> I want to write an program "uploadstring(std::string content, std::string filename)" that writes me file named "filename" to the remote computer where "content" is the content of the file.
>
> How shall I write my readfunction for such an upload?
> How to do a "normal" file upload is clear.

What kind of upload? If you're doing a POST, you can use the
CURLOPT_POSTFIELDS option. For other kinds of uploads, I think you'll
have to install a read callback handler that simply reads from the string
instead of a file. That's like the opposite of the getinmemory.c example
program.

>>> Dan

-- 
http://www.MoveAnnouncer.com              The web change of address service
          Let webmasters know that your web site has moved
Received on 2008-12-11