Extract cloud upload form helper
This commit is contained in:
@@ -43,6 +43,20 @@ int progress_callback_upload(void* clientp, curl_off_t dltotal,
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct curl_httppost* create_cloud_upload_form(const std::string& filename)
|
||||
{
|
||||
struct curl_httppost* formpost = NULL;
|
||||
struct curl_httppost* lastptr = NULL;
|
||||
|
||||
curl_formadd(&formpost,
|
||||
&lastptr,
|
||||
CURLFORM_COPYNAME, "fileToUpload",
|
||||
CURLFORM_FILE, filename.c_str(),
|
||||
CURLFORM_END);
|
||||
|
||||
return formpost;
|
||||
}
|
||||
|
||||
void execute_cloud_download_transfer(
|
||||
App& app,
|
||||
std::string url,
|
||||
@@ -102,18 +116,10 @@ void execute_cloud_upload_transfer(
|
||||
}
|
||||
|
||||
CURL* curl;
|
||||
|
||||
struct curl_httppost* formpost = NULL;
|
||||
struct curl_httppost* lastptr = NULL;
|
||||
auto* formpost = create_cloud_upload_form(filename);
|
||||
|
||||
//curl_global_init(CURL_GLOBAL_ALL);
|
||||
|
||||
curl_formadd(&formpost,
|
||||
&lastptr,
|
||||
CURLFORM_COPYNAME, "fileToUpload",
|
||||
CURLFORM_FILE, filename.c_str(),
|
||||
CURLFORM_END);
|
||||
|
||||
curl = curl_easy_init();
|
||||
std::string res;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user