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