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