How do I upload files from C++ using curl to PHP server – CodeProject
i just need a very simple example in which if i send files of type .docx or .pdf from c++ to my php script i can save them in folder on php server
What I have tried:
this is what i know how i can send values of variables from c++ using curl but i am looking for method to upload files to folders in php server and not in tables
CURL * curl; curl_global_init(CURL_GLOBAL_ALL); CURLcode res;string
UserName = pcobj.getUserName();string
request ="
UserName="
+ UserName;string
url ="
http://localhost:8084/project/Files.php"
; curl = curl_easy_init();if
(curl) { curl_easy_setopt(curl, CURLOPT_URL, url.c_str()); curl_easy_setopt(curl, CURLOPT_POSTFIELDS, request.c_str()); res = curl_easy_perform(curl);if
(res != CURLE_OK) { fprintf(stderr,"
curl_easy_perform() failed: %s\n"
, curl_easy_strerror(res)); } curl_easy_cleanup(curl); } curl_global_cleanup();
Please don’t give links of curl documentation or examples as they are very old and confusingi just need a very simple example in which if i send files of type .docx or .pdf from c++ to my php script i can save them in folder on php serverthis is what i know how i can send values of variables from c++ using curl but i am looking for method to upload files to folders in php server and not in tables