2
0

curl_mime_filename.3 2.7 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_filename 3 "22 August 2017" "libcurl" "libcurl"
  25. .SH NAME
  26. curl_mime_filename - set a mime part's remote file name
  27. .SH SYNOPSIS
  28. .nf
  29. #include <curl/curl.h>
  30. CURLcode curl_mime_filename(curl_mimepart *part,
  31. const char *filename);
  32. .fi
  33. .SH DESCRIPTION
  34. \fIcurl_mime_filename(3)\fP sets a mime part's remote file name. When remote
  35. file name is set, content data is processed as a file, whatever is the part's
  36. content source. A part's remote file name is transmitted to the server in the
  37. associated Content-Disposition generated header.
  38. \fIpart\fP is the part's handle to assign the remote file name to.
  39. \fIfilename\fP points to the null-terminated file name string; it may be set
  40. to NULL to remove a previously attached remote file name.
  41. The remote file name string is copied into the part, thus the associated
  42. storage may safely be released or reused after call. Setting a part's file
  43. name multiple times is valid: only the value set by the last call is retained.
  44. .SH EXAMPLE
  45. .nf
  46. curl_mime *mime;
  47. curl_mimepart *part;
  48. /* create a mime handle */
  49. mime = curl_mime_init(easy);
  50. /* add a part */
  51. part = curl_mime_addpart(mime);
  52. /* send image data from memory */
  53. curl_mime_data(part, imagebuf, imagebuf_len);
  54. /* set a file name to make it look like a file upload */
  55. curl_mime_filename(part, "image.png");
  56. /* set name */
  57. curl_mime_name(part, "data");
  58. .fi
  59. .SH AVAILABILITY
  60. As long as at least one of HTTP, SMTP or IMAP is enabled. Added in 7.56.0.
  61. .SH RETURN VALUE
  62. CURLE_OK or a CURL error code upon failure.
  63. .SH "SEE ALSO"
  64. .BR curl_mime_addpart "(3),"
  65. .BR curl_mime_filedata "(3),"
  66. .BR curl_mime_data "(3)"