int http_post_file(const char *url, const char *user, const char *pwd, const char *filename)
{
assert(url != NULL);
assert(user != NULL);
assert(pwd != NULL);
assert(filename != NULL);
int ret = -1;
CURL *curl = NULL;
CURLcode code;
CURLFORMcode formCode;
int timeout = 15;
#define CHECK_FORM_ERROR(x) /
if ((formCode = (x)) != CURL_FORMADD_OK) /
{ /
fprintf(stderr, "curl_formadd[%d] error./n", formCode); /
goto out; /
}
#define CHECK_SETOPT_ERROR(x) /
if ((code = (x)) != CURLE_OK)
C++ 基于libcurl库,进行文件上传
最新推荐文章于 2024-07-30 09:03:28 发布