curl_formfree(3)

curl_formfree3

Free a previously build multipart form post chain

Usage

#include <curl/curl.h>
void curl_formfree(struct curl_httppost *form);

Overview

This function is deprecated. Do not use. See curl_mime_init(3) instead!

curl_formfree() is used to clean up data previously built/appended with curl_formadd(3). This must be called when the data has been used, which typically means after curl_easy_perform(3) has been called.

The pointer to free is the same pointer you passed to the CURLOPT_HTTPPOST(3) option, which is the firstitem pointer from the curl_formadd(3) invoke(s).

form is the pointer as returned from a previous call to curl_formadd(3) and may be NULL.

Passing in a NULL pointer in form makes this function return immediately with no action.

Examples

int main(void)
{
  CURL *curl = curl_easy_init();
  if(curl) {
    struct curl_httppost *formpost;
    struct curl_httppost *lastptr;
    /* Fill in a file upload field */
    curl_formadd(&formpost,
                 &lastptr,
                 CURLFORM_COPYNAME, "file",
                 CURLFORM_FILE, "nice-image.jpg",
                 CURLFORM_END);
    curl_easy_setopt(curl, CURLOPT_HTTPPOST, formpost);
    curl_easy_perform(curl);
    /* then cleanup the formpost chain */
    curl_formfree(formpost);
  }
}

Return value

None

Releases

155 releases since Mac OS X 10.2; the text changed 19 times.

  1. 10.2–10.2.8
  2. 10.3–10.3.9
  3. 10.4–10.5.8
  4. 10.6–10.6.8
  5. 10.7–10.7.5
  6. 10.8–10.9.5
  7. 10.10–10.11.6
  8. 10.12–10.12.5
  9. 10.12.6–10.14.6
  10. 10.15–11.5
  11. 12.0.1–12.2
  12. 12.3–12.5
  13. 13.0
  14. 13.1
  15. 13.2
  16. 13.3
  17. 13.4
  18. 13.5–14.1
  19. 14.2–14.4
  20. 14.5–26.5

Availability

Deprecated in 7.56.0.

From curl 166.0.0.0.1 in macOS 26.5. Parsed by carta from the page's man source.