• Unfortunately, we have experienced significant hard drive damage that requires urgent maintenance and rebuilding. The forum will be a state of read only until we install our new drives and rebuild all the configurations needed. Please follow our Facebook page for updates, we will be back up shortly! (The forum could go offline at any given time due to the nature of the failed drives whilst awaiting the upgrades.) When you see an Incapsula error, you know we are in the process of migration.

Check if file exist for form curl.

Custom Title Activated
Loyal Member
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();
 
Back
Top