2
0

curl_mime_data.3 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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_mime_data 3 "22 August 2017" "libcurl" "libcurl"
  25. .SH NAME
  26. curl_mime_data - set a mime part's body data from memory
  27. .SH SYNOPSIS
  28. .nf
  29. #include <curl/curl.h>
  30. CURLcode curl_mime_data(curl_mimepart *part, const char *data,
  31. size_t datasize);
  32. .fi
  33. .SH DESCRIPTION
  34. \fIcurl_mime_data(3)\fP sets a mime part's body content from memory data.
  35. \fIpart\fP is the mime part to assign contents to, created with
  36. \fIcurl_mime_addpart(3)\fP.
  37. \fIdata\fP points to the data that gets copied by this function. The storage
  38. may safely be reused after the call.
  39. \fIdatasize\fP is the number of bytes \fIdata\fP points to. It can be set to
  40. \fICURL_ZERO_TERMINATED\fP to indicate \fIdata\fP is a null-terminated
  41. character string.
  42. Setting a part's contents multiple times is valid: only the value set by the
  43. last call is retained. It is possible to unassign part's contents by setting
  44. \fIdata\fP to NULL.
  45. Setting large data is memory consuming: one might consider using
  46. \fIcurl_mime_data_cb(3)\fP in such a case.
  47. .SH EXAMPLE
  48. .nf
  49. curl_mime *mime;
  50. curl_mimepart *part;
  51. /* create a mime handle */
  52. mime = curl_mime_init(easy);
  53. /* add a part */
  54. part = curl_mime_addpart(mime);
  55. /* add data to the part */
  56. curl_mime_data(part, "raw contents to send", CURL_ZERO_TERMINATED);
  57. .fi
  58. .SH AVAILABILITY
  59. As long as at least one of HTTP, SMTP or IMAP is enabled. Added in 7.56.0.
  60. .SH RETURN VALUE
  61. CURLE_OK or a CURL error code upon failure.
  62. .SH "SEE ALSO"
  63. .BR curl_mime_addpart "(3),"
  64. .BR curl_mime_data_cb "(3),"
  65. .BR curl_mime_name "(3),"
  66. .BR curl_mime_type "(3)"