curl_formfree.3 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. .\" generated by cd2nroff 0.1 from curl_formfree.md
  2. .TH curl_formfree 3 "2025-01-17" libcurl
  3. .SH NAME
  4. curl_formfree \- free a previously build multipart form post chain
  5. .SH SYNOPSIS
  6. .nf
  7. #include <curl/curl.h>
  8. void curl_formfree(struct curl_httppost *form);
  9. .fi
  10. .SH DESCRIPTION
  11. This function is deprecated. Do not use. See \fIcurl_mime_init(3)\fP instead!
  12. curl_formfree() is used to clean up data previously built/appended with
  13. \fIcurl_formadd(3)\fP. This must be called when the data has been used, which
  14. typically means after \fIcurl_easy_perform(3)\fP has been called.
  15. The pointer to free is the same pointer you passed to the
  16. \fICURLOPT_HTTPPOST(3)\fP option, which is the \fIfirstitem\fP pointer from
  17. the \fIcurl_formadd(3)\fP invoke(s).
  18. \fBform\fP is the pointer as returned from a previous call to
  19. \fIcurl_formadd(3)\fP and may be NULL.
  20. Passing in a NULL pointer in \fIform\fP makes this function return immediately
  21. with no action.
  22. .SH PROTOCOLS
  23. This functionality affects http only
  24. .SH EXAMPLE
  25. .nf
  26. int main(void)
  27. {
  28. CURL *curl = curl_easy_init();
  29. if(curl) {
  30. struct curl_httppost *formpost;
  31. struct curl_httppost *lastptr;
  32. /* Fill in a file upload field */
  33. curl_formadd(&formpost,
  34. &lastptr,
  35. CURLFORM_COPYNAME, "file",
  36. CURLFORM_FILE, "nice-image.jpg",
  37. CURLFORM_END);
  38. curl_easy_setopt(curl, CURLOPT_HTTPPOST, formpost);
  39. curl_easy_perform(curl);
  40. /* then cleanup the formpost chain */
  41. curl_formfree(formpost);
  42. }
  43. }
  44. .fi
  45. .SH DEPRECATED
  46. Deprecated in 7.56.0.
  47. .SH AVAILABILITY
  48. Added in curl 7.1
  49. .SH RETURN VALUE
  50. None
  51. .SH SEE ALSO
  52. .BR curl_formadd (3),
  53. .BR curl_mime_free (3),
  54. .BR curl_mime_init (3)