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