cURL / Mailing Lists / curl-library / Single Mail

curl-library

Fw: Posting a file with libcurl

From: Patrick Demers <p_dem_at_hotmail.com>
Date: Mon, 20 Jul 2009 16:09:26 -0400

Hi,
    i have a c++ project where i post a file using curl_form. When my file path contain only non-unicode char, the file post correctly, but when i have unicode char in the file path, it does not work. Anyone have an idea of how i can post a file with unicode in the filepath ?

code example :

CComBSTR strPath("");
strPath.Append(m_strSnapShotPath); //path to My Picture, wich can contain some unicode char on some client system
strPath.Append("\\");
strPath.Append(fileName);

struct curl_httppost *formpost=NULL;
struct curl_httppost *lastptr=NULL;

// Fill in the file upload field.
curl_formadd(
&formpost, &lastptr,
CURLFORM_COPYNAME, "filename",
CURLFORM_FILE, strPath,
CURLFORM_END
);

// Fill in the submit field
curl_formadd(
&formpost, &lastptr,
CURLFORM_COPYNAME, "submit",
CURLFORM_COPYCONTENTS, "send",
CURLFORM_END
);

curl_easy_setopt(curl, CURLOPT_URL, m_strUploadUrl.m_str);
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headerlist);
curl_easy_setopt(curl, CURLOPT_HTTPPOST, formpost);
Received on 2009-07-20