curl_formfree.3 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. .\" **************************************************************************
  2. .\" * _ _ ____ _
  3. .\" * Project ___| | | | _ \| |
  4. .\" * / __| | | | |_) | |
  5. .\" * | (__| |_| | _ <| |___
  6. .\" * \___|\___/|_| \_\_____|
  7. .\" *
  8. .\" * Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
  9. .\" *
  10. .\" * This software is licensed as described in the file COPYING, which
  11. .\" * you should have received as part of this distribution. The terms
  12. .\" * are also available at https://curl.se/docs/copyright.html.
  13. .\" *
  14. .\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell
  15. .\" * copies of the Software, and permit persons to whom the Software is
  16. .\" * furnished to do so, under the terms of the COPYING file.
  17. .\" *
  18. .\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
  19. .\" * KIND, either express or implied.
  20. .\" *
  21. .\" * SPDX-License-Identifier: curl
  22. .\" *
  23. .\" **************************************************************************
  24. .TH curl_formfree 3 "6 April 2001" "libcurl" "libcurl"
  25. .SH NAME
  26. curl_formfree - free a previously build multipart form post chain
  27. .SH SYNOPSIS
  28. .nf
  29. #include <curl/curl.h>
  30. void curl_formfree(struct curl_httppost *form);
  31. .fi
  32. .SH DESCRIPTION
  33. This function is deprecated. Do not use. See \fIcurl_mime_init(3)\fP instead!
  34. curl_formfree() is used to clean up data previously built/appended with
  35. \fIcurl_formadd(3)\fP. This must be called when the data has been used, which
  36. typically means after \fIcurl_easy_perform(3)\fP has been called.
  37. The pointer to free is the same pointer you passed to the
  38. \fICURLOPT_HTTPPOST(3)\fP option, which is the \fIfirstitem\fP pointer from
  39. the \fIcurl_formadd(3)\fP invoke(s).
  40. \fBform\fP is the pointer as returned from a previous call to
  41. \fIcurl_formadd(3)\fP and may be NULL.
  42. Passing in a NULL pointer in \fIform\fP makes this function return immediately
  43. with no action.
  44. .SH EXAMPLE
  45. .nf
  46. int main(void)
  47. {
  48. CURL *curl = curl_easy_init();
  49. if(curl) {
  50. struct curl_httppost *formpost;
  51. struct curl_httppost *lastptr;
  52. /* Fill in a file upload field */
  53. curl_formadd(&formpost,
  54. &lastptr,
  55. CURLFORM_COPYNAME, "file",
  56. CURLFORM_FILE, "nice-image.jpg",
  57. CURLFORM_END);
  58. curl_easy_setopt(curl, CURLOPT_HTTPPOST, formpost);
  59. curl_easy_perform(curl);
  60. /* then cleanup the formpost chain */
  61. curl_formfree(formpost);
  62. }
  63. }
  64. .fi
  65. .SH AVAILABILITY
  66. Deprecated in 7.56.0.
  67. .SH RETURN VALUE
  68. None
  69. .SH "SEE ALSO"
  70. .BR curl_formadd (3),
  71. .BR curl_mime_init (3),
  72. .BR curl_mime_free (3)