summaryrefslogtreecommitdiff
path: root/docs/libcurl/curl_mime_filename.3
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2017-09-05 11:14:42 +0200
committerDaniel Stenberg <daniel@haxx.se>2017-09-05 11:15:02 +0200
commiteae21db920b19ed0729196165f0abf54749cf6db (patch)
treee8e22ff67f702b1518aac83a4f662a56690afc8b /docs/libcurl/curl_mime_filename.3
parent889723b004667abc061f9a23e928aba064b7f2a0 (diff)
downloadcurl-eae21db920b19ed0729196165f0abf54749cf6db.tar.gz
docs/curl_mime_*.3: added examples
Diffstat (limited to 'docs/libcurl/curl_mime_filename.3')
-rw-r--r--docs/libcurl/curl_mime_filename.322
1 files changed, 22 insertions, 0 deletions
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) "