windows - C++使用curl提交分块大文件,curl参数选取问题
ringa_lee
ringa_lee 2017-04-17 13:32:32
0
1
984
ringa_lee
ringa_lee

ringa_lee

reply all(1)
刘奇
        curl_formadd(&formpost,
        &lastptr,
        CURLFORM_COPYNAME, "files[]",
        CURLFORM_BUFFER, filename.c_str(),//filename
        CURLFORM_BUFFERPTR, postdata,//the uploaded data
        CURLFORM_BUFFERLENGTH, strlen(postdata),//the length of uploaded data
        CURLFORM_CONTENTTYPE, "multipart/form-data",//contenttype
        CURLFORM_END);

This is just a matter of replacing the segmented form. You need to control the offset of the pointer postdata yourself.

The callback function specified by READFUNCITON is best combined with CURLFORM_STREAM.

When uploading using the callback function READFUNCTION, specify the callback function, but the second and third parameters of the callback function are not specified. In other words, the amount of data read each time is uncertain. How does curl rely on this? What about uploading all the data in one callback?
When a callback function is specified, curl will try its best to transfer data. When the specified callback function returns 0, it means the upload is completed.

For details of learning materials, please see:
https://curl.haxx.se/libcurl/c/curl_easy_setopt.html
https://curl.haxx.se/libcurl/c/curl_formadd.html
http://blog.csdn.net/hzyong_c/article/details/7773494
http://www.darkbull.net/opensource/bad/libcurl_tutorial/#
http://www.seanyxie.com /libcurl%E4%B8%8B%E8%BD%BD%E5%AE%89%E8%A3%85%E5%92%8C%E4%BD%BF%E7%94%A8%E6%96%B9 %E6%B3%95/

Ask and answer your own question.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template