From eae21db920b19ed0729196165f0abf54749cf6db Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Tue, 5 Sep 2017 11:14:42 +0200 Subject: docs/curl_mime_*.3: added examples --- docs/libcurl/curl_mime_filename.3 | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'docs/libcurl/curl_mime_filename.3') diff --git a/docs/libcurl/curl_mime_filename.3 b/docs/libcurl/curl_mime_filename.3 index db4482cdd..5a2ca6ec2 100644 --- a/docs/libcurl/curl_mime_filename.3 +++ b/docs/libcurl/curl_mime_filename.3 @@ -35,6 +35,7 @@ content source. A part's remote file name is transmitted to the server in the associated Content-Disposition generated header. \fIpart\fP is the part's handle to assign the remote file name to. + \fIfilename\fP points to the nul-terminated file name string; it may be set to NULL to remove a previously attached remote file name. @@ -45,6 +46,27 @@ name twice is valid: only the value set by the last call is retained. As long as at least one of HTTP, SMTP or IMAP is enabled. Added in 7.56.0. .SH RETURN VALUE CURLE_OK or a CURL error code upon failure. +.SH EXAMPLE +.nf + struct curl_mime *mime; + struct mimepart *part; + + /* create a mime handle */ + mime = curl_mime_init(easy); + + /* add a part */ + part = curl_mime_addpart(mime); + + /* send image data from memory */ + curl_mime_data(part, imagebuf, imagebuf_len); + + /* set a file name to make it look like a file upload */ + curl_mime_filename(part, "image.png"); + + /* set name */ + curl_mime_name(part, "data", CURL_ZERO_TERMINATED); +.fi .SH "SEE ALSO" .BR curl_mime_addpart "(3) " .BR curl_mime_filedata "(3) " +.BR curl_mime_data "(3) " -- cgit v1.2.3