Extract cloud upload form helper

This commit is contained in:
2026-06-15 20:11:08 +02:00
parent 63f0cd1773
commit 9efb080202
4 changed files with 63 additions and 10 deletions

View File

@@ -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;