Re: libcurl c++
Date: Mon, 26 Mar 2007 14:01:50 +0530
Uploading using HTTP. when I tried PUT/UPLOAD first, I received 405 error.
then only I came to know that our server supports only GET and POST methods.
So, can we upload a file using HTTP_POST?
here's my current attempt.
curl_easy_setopt(m_handle, CURLOPT_VERBOSE , 1);
curl_easy_setopt(m_handle, CURLOPT_SSL_VERIFYHOST, 1);
curl_easy_setopt(m_handle, CURLOPT_FOLLOWLOCATION, 1);
curl_easy_setopt(m_handle, CURLOPT_READFUNCTION, read_callback);
curl_easy_setopt(m_handle, CURLOPT_POST, 1);
curl_easy_setopt(m_handle, CURLOPT_READDATA, hd_src);
curl_easy_setopt(m_handle, CURLOPT_URL, m_strEncodedURL.c_str() );
performResult = curl_easy_perform(m_handle);
On 3/26/07, Daniel Stenberg <daniel_at_haxx.se> wrote:
> On Mon, 26 Mar 2007, Uday wrote:
> > can anybody help me uploading a file (text/zip) to a remote server
> > using libcurl libraries in c++.
> Upload how? What protocol for example?
> > when i searched in google, i found that i've to use CURLOPT_POST,
> > CURLOPT_INFILE which points to the actual file & READFUNCTION which
> > the content from the file and puts in the buffer.
> That works for regular HTTP POST, yes, but that's rarely what people
> mean when they talk about "file upload".
> > i'm setting the file size also in CURLOPT_INFILESIZE. i'm not getting
> > exception neither the expected result.
> So what is the server expecting you to do? How does your current attempt
> Commercial curl and libcurl Technical Support: http://haxx.se/curl.html
-- Thanks & Regards, UdayReceived on 2007-03-26