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