curl_mime_data.3 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. .\" **************************************************************************
  2. .\" * _ _ ____ _
  3. .\" * Project ___| | | | _ \| |
  4. .\" * / __| | | | |_) | |
  5. .\" * | (__| |_| | _ <| |___
  6. .\" * \___|\___/|_| \_\_____|
  7. .\" *
  8. .\" * Copyright (C) 1998 - 2020, 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. .\" **************************************************************************
  22. .TH curl_mime_data 3 "22 August 2017" "libcurl 7.56.0" "libcurl Manual"
  23. .SH NAME
  24. curl_mime_data - set a mime part's body data from memory
  25. .SH SYNOPSIS
  26. .B #include <curl/curl.h>
  27. .sp
  28. .BI "CURLcode curl_mime_data(curl_mimepart * " part ", const char * " data
  29. .BI ", size_t " datasize ");"
  30. .ad
  31. .SH DESCRIPTION
  32. \fIcurl_mime_data(3)\fP sets a mime part's body content from memory data.
  33. \fIdata\fP points to the data bytes: those are copied to the part and their
  34. storage may safely be reused after call.
  35. \fIdatasize\fP is the number of data bytes: it can be set to
  36. \fICURL_ZERO_TERMINATED\fP to indicate \fIdata\fP is a null-terminated
  37. character string.
  38. \fIpart\fP is the part's to assign contents to.
  39. Setting a part's contents twice is valid: only the value set by the last call
  40. is retained. It is possible to unassign part's contents by setting
  41. \fIdata\fP to NULL.
  42. Setting very large data is memory consuming: one might consider using
  43. \fIcurl_mime_data_cb(3)\fP in such a case.
  44. .SH AVAILABILITY
  45. As long as at least one of HTTP, SMTP or IMAP is enabled. Added in 7.56.0.
  46. .SH RETURN VALUE
  47. CURLE_OK or a CURL error code upon failure.
  48. .SH EXAMPLE
  49. .nf
  50. curl_mime *mime;
  51. curl_mimepart *part;
  52. /* create a mime handle */
  53. mime = curl_mime_init(easy);
  54. /* add a part */
  55. part = curl_mime_addpart(mime);
  56. /* add data to the part */
  57. curl_mime_data(part, "raw contents to send", CURL_ZERO_TERMINATED);
  58. .fi
  59. .SH "SEE ALSO"
  60. .BR curl_mime_addpart "(3),"
  61. .BR curl_mime_data_cb "(3),"
  62. .BR curl_mime_name "(3),"
  63. .BR curl_mime_type "(3)"