cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Progress During Posts

From: Traxler Bence <tbence_at_inf.bme.hu>
Date: 13 Nov 2002 02:35:09 +0100

Hi,

I had the same problem a month ago and I don't remember what was wrong
:) but now it's working with this:

void setFilePost(wxString id, wxArrayString* filenames, wxGauge* gauge)
{
[...]

        //Add files
        for (int i = 0; i < (int)filenames->GetCount(); i++)
        {
                curl_formadd(&form, &last, CURLFORM_COPYNAME, "files[]",
                        CURLFORM_FILE, filenames->Item(i).c_str(),
CURLFORM_END);
        }

        [... setting other from fields ... ]

        //Set curl options
        curl_easy_setopt(curl, CURLOPT_HTTPPOST, form);
        curl_easy_setopt(curl, CURLOPT_NOPROGRESS, FALSE);
        curl_easy_setopt(curl, CURLOPT_PROGRESSFUNCTION,
progressUpdater);
        curl_easy_setopt(curl, CURLOPT_PROGRESSDATA, gauge);

        [...]
}

int progressUpdater(wxGauge* gauge, double dltotal, double dlnow, double
ultotal, double ulnow)
{
        gauge->SetValue(gauge->GetValue() + (int)((double)(ulnow * 100)
/
(double)ultotal));
        ::wxYield();
        return 0;
}

Miles Clark wrote:
> Hello All -
>
> Does the CURLOPT_PROGRESSFUNCTION callback work for normal HTTP Posts?
> I'm doing posts with large field values (sometimes uploading a file
via
> HTTP Post), and I can get the libcurl to call my callback function,
but
> the values are *always* 0 for both upload and download stats.
>
> I've tried both "normal" posts and multipart posts, set the
> POSTFIELDSIZE option directly, etc. -- with no luck.
>
> Any ideas?
>
> thanks in advance!
>
> Miles
>

-------------------------------------------------------
This sf.net email is sponsored by:
To learn the basics of securing your web site with SSL,
click here to get a FREE TRIAL of a Thawte Server Certificate:
http://www.gothawte.com/rd522.html
Received on 2002-11-13