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

ringa_lee

répondre à tous(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);

这就是分段的表单替换掉就好了,需要自己进行指针postdata的偏移控制。

READFUNCITON所指定的回调函数最好和CURLFORM_STREAM进行配合。

使用回调函数READFUNCTION上传的时候,指定好回调函数,但是回调函数的第二和第三参数是没有被指定的,换而言之就是每次读取的数据量不定,curl如何靠这一个回调上传完所有数据呢?
这个在指定了回调函数的情形下,curl会尽可能的去传递数据,当指定的回调函数返回0的时候,表示上传完成。

学习资料详情参见:
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/

自问自答了。

Derniers téléchargements
Plus>
effets Web
Code source du site Web
Matériel du site Web
Modèle frontal
À propos de nous Clause de non-responsabilité Sitemap
Site Web PHP chinois:Formation PHP en ligne sur le bien-être public,Aidez les apprenants PHP à grandir rapidement!