cURL / Mailing Lists / curl-library / Single Mail

curl-library

Reading from a stream

From: Robert Bielik <robert.bielik_at_xponaut.se>
Date: Thu, 27 Mar 2008 14:49:45 +0100

Hi all,

I'm facing a problem uploading a file via libcurl. As far as I've rtfm I'm stuck with:

A. Letting curl read the contents from the file, which means curl opening the file on Win32 by fopen which
is not possible since fopen does not support UTF-8 filenames (which I need to support swedish char sets).

B. Letting curl post via a buffer, which means I have to read in the whole xxx MB size into memory, then
use curl to post it. This is of course a big no, no (AddFormData as I saw copies the entire buffer (!))

So I feel stuck between a rock and a hard place.

What I'd want to do is to provide curl with a stream pointer and just tell curl how large it is, not having
curl test-open the file or anything, then just call me back via curl_read_callback and I'll just provide
the data without curl knowing anything about the underlying file.

Please point me in the right direction as I somehow feel that CURL being the mature and great lib it is, this
must be possible somehow. Right?

TIA
/Rob
Received on 2008-03-27