1

I need to upload a large file (>2 GB) using multipart POST request. Source file can be named using unicode symbols. The problem is that libcurl does not support unicode wfopen in windows, so I am not able to complete this task in usual way like

curl_formadd(&formpost, &lastptr,
  CURLFORM_COPYNAME, fieldname,
  CURLFORM_FILENAME, filename,
  CURLFORM_FILE, full_path_to_file,
  CURLFORM_CONTENTTYPE, "application/octet-stream",
  CURLFORM_END);

I figured out that I can use a CURLFORM_STREAM option of curl_formadd in conjunction with CURLOPT_READFUNCTION. Now I need to manually set the file size through CURLFORM_CONTENTSLENGTH option, but it accepts only "long" as a parameter when I need to set a "long long" file size. After a look through curl manual I found some CURLOPT_POSTFIELDSIZE_LARGE option, but it does nothing in my case. It seems that multipart request system ignores this parameter. I don't know what to do, I don't want to give up unicode names or large files support.

Bronson
  • 11
  • 4

0 Answers0