cURL / Mailing Lists / curl-library / Single Mail

curl-library

Help w/ HTTP file upload [bug?]

From: Ryan M. Lederman <lederman_at_gmail.com>
Date: Wed, 9 Dec 2009 12:47:18 -0700

Guys/Gals,

I'm trying to use cURL to upload a file to an HTTP server using
curl_formadd(CURLFORM_FILE) and trying to get upload progress through
curl_easy_setopt(CURLOPT_PROGRESSFUNCTION).

**Expected behavior**: curl calls back while uploading with the proper
values set for ulnow and ultotal about once every second.

**Actual behavior**: curl appears to call the callback in quick succession
about 50 times, seemingly while reading the file from disk, THEN begins
calling the progress callback at ~1sec intervals where ulnow == ultotal
every call (apparently while actually uploading).

The file IS actually posted correctly to the server, but I cannot properly
make a GUI progress bar with the callback behavior in this setup.

Has anyone else experienced this? Is it a bug? I'm about to dig into the
curl code and don't want to do that if it isn't necessary.

My next attempt at solving was going to be implementing manual file reading
via curl_easy_setopt(CURLOPT_READFUNCTION).

Other info:
  Version: 7.19.7
  Platform: Windows
  Environment: C/C++ / MSVS 9
  cURL: Static lib

-- 
"Liberty can not be preserved without a general knowledge among the people."
- John Adams
-- Ryan M. Lederman

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2009-12-09