- Joined
- Mar 26, 2012
- Messages
- 1,465
- Reaction score
- 131
I want to simply see if a file exists so that it will add another formadd for CURL in C++. Any help would be appreciated. Here is my code so far but, need help.
Code:
CURL *curl;
struct curl_httppost *formpost = NULL;
struct curl_httppost *lastptr = NULL;
curl_global_init(CURL_GLOBAL_ALL);
curl_formadd(&formpost,
&lastptr,
CURLFORM_COPYNAME, "image",
CURLFORM_FILE, "1stfile.txt",
CURLFORM_END);
if(ifstream("2ndfile.txt")){
curl_formadd(&formpost,
&lastptr,
CURLFORM_COPYNAME, "image",
CURLFORM_FILE, "2ndfile.txt",
CURLFORM_END);
}
curl_formadd(&formpost,
&lastptr,
CURLFORM_COPYNAME, "submit",
CURLFORM_COPYCONTENTS, "submit",
CURLFORM_END);
curl = curl_easy_init();