Hi,
Does anyone have an example how to post file with post fields (using cURL)?
Currently, I'm using this piece of code for POST requests:
curl := curl_easy_init()
curl_easy_setopt(curl, HB_CURLOPT_URL, "http://localhost/test/post.php")
curl_easy_setopt(curl, HB_CURLOPT_POST, .T.);
curl_easy_setopt(curl, HB_CURLOPT_POSTFIELDS, "param1=value1¶m2=value2);
? curl_easy_perform(curl)
curl_easy_cleanup(curl)I'm not able to find any working example how to attach file to this post request.
As I can see, this is intended for other purposes (mail attachment, etc.)
curl_easy_setopt(curl, HB_CURLOPT_UL_FILE_SETUP, "file_to_send.ext")
curl_easy_setopt(curl, HB_CURLOPT_INFILESIZE, hb_FSize("file_to_send.ext"))Any help is appreciated!
Regards,
Aleksandar