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