diff options
author | Daniel Stenberg <daniel@haxx.se> | 2014-10-21 13:40:38 +0200 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2014-10-21 13:40:38 +0200 |
commit | 4cb7aa067cb3fb01601dd5d164be8cefe6042211 (patch) | |
tree | 259d3d545060b10d6f0bc0da7c20bd3d4c84a2df /docs/libcurl/opts/CURLOPT_UPLOAD.3 | |
parent | 411103251130767daab1b0d966a674b6b822707e (diff) | |
download | curl-4cb7aa067cb3fb01601dd5d164be8cefe6042211.tar.gz |
opts: provide more and updated examples
Diffstat (limited to 'docs/libcurl/opts/CURLOPT_UPLOAD.3')
-rw-r--r-- | docs/libcurl/opts/CURLOPT_UPLOAD.3 | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/docs/libcurl/opts/CURLOPT_UPLOAD.3 b/docs/libcurl/opts/CURLOPT_UPLOAD.3 index 8d815906d..d24bd289e 100644 --- a/docs/libcurl/opts/CURLOPT_UPLOAD.3 +++ b/docs/libcurl/opts/CURLOPT_UPLOAD.3 @@ -47,7 +47,28 @@ must specify the size. .SH PROTOCOLS Most .SH EXAMPLE -TODO +.nf +CURL *curl = curl_easy_init(); +if(curl) { + /* we want to use our own read function */ + curl_easy_setopt(curl, CURLOPT_READFUNCTION, read_callback); + + /* enable uploading */ + curl_easy_setopt(curl, CURLOPT_UPLOAD, 1L); + + /* specify target */ + curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com/dir/to/newfile"); + + /* now specify which pointer to pass to our callback */ + curl_easy_setopt(curl, CURLOPT_READDATA, hd_src); + + /* Set the size of the file to upload */ + curl_easy_setopt(curl, CURLOPT_INFILESIZE_LARGE, (curl_off_t)fsize); + + /* Now run off and do what you've been told! */ + curl_easy_perform(curl); +} +.fi .SH AVAILABILITY Always .SH RETURN VALUE |