1---
2c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
3SPDX-License-Identifier: curl
4Title: CURLOPT_RESUME_FROM
5Section: 3
6Source: libcurl
7See-also:
8  - CURLOPT_INFILESIZE (3)
9  - CURLOPT_RANGE (3)
10  - CURLOPT_RESUME_FROM_LARGE (3)
11Protocol:
12  - All
13---
14
15# NAME
16
17CURLOPT_RESUME_FROM - offset to resume transfer from
18
19# SYNOPSIS
20
21~~~c
22#include <curl/curl.h>
23
24CURLcode curl_easy_setopt(CURL *handle, CURLOPT_RESUME_FROM, long from);
25~~~
26
27# DESCRIPTION
28
29Pass a long as parameter. It contains the offset in number of bytes that you
30want the transfer to start from. Set this option to 0 to make the transfer
31start from the beginning (effectively disabling resume). For FTP, set this
32option to -1 to make the transfer start from the end of the target file
33(useful to continue an interrupted upload).
34
35When doing uploads with FTP, the resume position is where in the local/source
36file libcurl should try to resume the upload from and it then appends the
37source file to the remote target file.
38
39If you need to resume a transfer beyond the 2GB limit, use
40CURLOPT_RESUME_FROM_LARGE(3) instead.
41
42# DEFAULT
43
440, not used
45
46# EXAMPLE
47
48~~~c
49int main(void)
50{
51  CURL *curl = curl_easy_init();
52  if(curl) {
53    long size_of_file;
54
55    curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com");
56
57    /* resume upload at byte index 200 */
58    curl_easy_setopt(curl, CURLOPT_RESUME_FROM, 200L);
59
60    /* ask for upload */
61    curl_easy_setopt(curl, CURLOPT_UPLOAD, 1L);
62
63    /* set total data amount to expect */
64    curl_easy_setopt(curl, CURLOPT_INFILESIZE, size_of_file);
65
66    /* Perform the request */
67    curl_easy_perform(curl);
68  }
69}
70~~~
71
72# AVAILABILITY
73
74Always
75
76# RETURN VALUE
77
78Returns CURLE_OK
79