curl-library
Re: how set a unicode or wstring file name for CURLFORM_FILE
Date: Wed, 23 Feb 2005 20:37:42 -0500
Hi Jeff,
thank you for your response the following method seems to be working
properly if i do not include any non-ascii characters in the filename
however when i do i still do encounter the CURL_READ_ERROR i am not sure if
CURL does handle multibyte characters correctly or if i am having some sort
of a conversion problem.
Thank You
-seymen
----- Original Message -----
From: "Jeff Phillips" <jeff_at_jeffp.net>
To: "libcurl development" <curl-library_at_cool.haxx.se>
Sent: Wednesday, February 23, 2005 5:41 PM
Subject: Re: how set a unicode or wstring file name for CURLFORM_FILE
> Hello Seyman,
>
> If you're working on a Microsoft platform, here's
> something you can do (it may work on Unix as well):
>
> int len = wcslen(fileToUpload.c_str());
> char* szFile = (char*)_alloca(len + 1);
> wcstombs(szFile, fileToUpload.c_str(), len + 1);
> curl_formadd(&formpost, &lastptr, CURLFORM_COPYNAME,
> "sendfile", CURLFORM_FILE, szFile, CURLFORM_END);
>
> Take care,
> Jeff
>
> --- Seymen Ertas <curlnewsgroup_at_seymen.com> wrote:
>
> >
> > Hi all,
> >
> > Anybody have an idea on how i can add a filename to
> > my form that is a wchar* ?
> >
> > When ever i pass in the filename as a wchar* curl
> > only recognizes the first letter of the file so it
> > always has a read error.
> >
> > Here is the line of code that i am having issues
> > with:
> > curl_formadd(&formpost, &lastptr, CURLFORM_COPYNAME,
> > "sendfile",CURLFORM_FILE,
> > fileToUpload.c_str(),CURLFORM_END);
> >
> > where fileToUpload is wstring
> >
> > Any help will be appreciated.
> >
> > Thank You
> >
>
Received on 2005-02-24