1--- 2c: Copyright (C) Daniel Stenberg, <daniel.se>, et al. 3SPDX-License-Identifier: curl 4Title: curl_formfree 5Section: 3 6Source: libcurl 7See-also: 8 - curl_formadd (3) 9 - curl_mime_free (3) 10 - curl_mime_init (3) 11--- 12 13# NAME 14 15curl_formfree - free a previously build multipart form post chain 16 17# SYNOPSIS 18 19~~~c 20#include <curl/curl.h> 21 22void curl_formfree(struct curl_httppost *form); 23~~~ 24 25# DESCRIPTION 26 27This function is deprecated. Do not use. See curl_mime_init(3) instead! 28 29curl_formfree() is used to clean up data previously built/appended with 30curl_formadd(3). This must be called when the data has been used, which 31typically means after curl_easy_perform(3) has been called. 32 33The pointer to free is the same pointer you passed to the 34CURLOPT_HTTPPOST(3) option, which is the *firstitem* pointer from 35the curl_formadd(3) invoke(s). 36 37**form** is the pointer as returned from a previous call to 38curl_formadd(3) and may be NULL. 39 40Passing in a NULL pointer in *form* makes this function return immediately 41with no action. 42 43# EXAMPLE 44 45~~~c 46int main(void) 47{ 48 CURL *curl = curl_easy_init(); 49 if(curl) { 50 struct curl_httppost *formpost; 51 struct curl_httppost *lastptr; 52 53 /* Fill in a file upload field */ 54 curl_formadd(&formpost, 55 &lastptr, 56 CURLFORM_COPYNAME, "file", 57 CURLFORM_FILE, "nice-image.jpg", 58 CURLFORM_END); 59 60 curl_easy_setopt(curl, CURLOPT_HTTPPOST, formpost); 61 62 curl_easy_perform(curl); 63 64 /* then cleanup the formpost chain */ 65 curl_formfree(formpost); 66 } 67} 68~~~ 69 70# AVAILABILITY 71 72Deprecated in 7.56.0. 73 74# RETURN VALUE 75 76None 77