aboutsummaryrefslogtreecommitdiff
path: root/docs/examples/fileupload.c
diff options
context:
space:
mode:
Diffstat (limited to 'docs/examples/fileupload.c')
-rw-r--r--docs/examples/fileupload.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/docs/examples/fileupload.c b/docs/examples/fileupload.c
index 756367b6b..665eca0af 100644
--- a/docs/examples/fileupload.c
+++ b/docs/examples/fileupload.c
@@ -64,14 +64,21 @@ int main(void)
curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
res = curl_easy_perform(curl);
+ /* Check for errors */
+ if(res != CURLE_OK) {
+ fprintf(stderr, "curl_easy_perform() failed: %s\n",
+ curl_easy_strerror(res));
- /* now extract transfer info */
- curl_easy_getinfo(curl, CURLINFO_SPEED_UPLOAD, &speed_upload);
- curl_easy_getinfo(curl, CURLINFO_TOTAL_TIME, &total_time);
+ }
+ else {
+ /* now extract transfer info */
+ curl_easy_getinfo(curl, CURLINFO_SPEED_UPLOAD, &speed_upload);
+ curl_easy_getinfo(curl, CURLINFO_TOTAL_TIME, &total_time);
- fprintf(stderr, "Speed: %.3f bytes/sec during %.3f seconds\n",
- speed_upload, total_time);
+ fprintf(stderr, "Speed: %.3f bytes/sec during %.3f seconds\n",
+ speed_upload, total_time);
+ }
/* always cleanup */
curl_easy_cleanup(curl);
}