1---
2c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
3SPDX-License-Identifier: curl
4Title: CURLINFO_SPEED_UPLOAD
5Section: 3
6Source: libcurl
7See-also:
8  - CURLINFO_SPEED_DOWNLOAD_T (3)
9  - curl_easy_getinfo (3)
10  - curl_easy_setopt (3)
11Protocol:
12  - All
13Added-in: 7.4.1
14---
15
16# NAME
17
18CURLINFO_SPEED_UPLOAD - get upload speed
19
20# SYNOPSIS
21
22~~~c
23#include <curl/curl.h>
24
25CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_SPEED_UPLOAD, double *speed);
26~~~
27
28# DESCRIPTION
29
30Pass a pointer to a double to receive the average upload speed that curl
31measured for the complete upload. Measured in bytes/second.
32
33CURLINFO_SPEED_UPLOAD_T(3) is a newer replacement that returns a more
34sensible variable type.
35
36# %PROTOCOLS%
37
38# EXAMPLE
39
40~~~c
41int main(void)
42{
43  CURL *curl = curl_easy_init();
44  if(curl) {
45    CURLcode res;
46    curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
47
48    /* Perform the request */
49    res = curl_easy_perform(curl);
50
51    if(!res) {
52      double speed;
53      res = curl_easy_getinfo(curl, CURLINFO_SPEED_UPLOAD, &speed);
54      if(!res) {
55        printf("Upload speed %.0f bytes/sec\n", speed);
56      }
57    }
58  }
59}
60~~~
61
62# DEPRECATED
63
64Deprecated since 7.55.0.
65
66# %AVAILABILITY%
67
68# RETURN VALUE
69
70Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not.
71