1---
2c: Copyright (C) Daniel Stenberg, <daniel.se>, et al.
3SPDX-License-Identifier: curl
4Title: CURLOPT_NEW_FILE_PERMS
5Section: 3
6Source: libcurl
7See-also:
8  - CURLOPT_NEW_DIRECTORY_PERMS (3)
9  - CURLOPT_UPLOAD (3)
10---
11
12# NAME
13
14CURLOPT_NEW_FILE_PERMS - permissions for remotely created files
15
16# SYNOPSIS
17
18~~~c
19#include <curl/curl.h>
20
21CURLcode curl_easy_setopt(CURL *handle, CURLOPT_NEW_FILE_PERMS,
22                          long mode);
23~~~
24
25# DESCRIPTION
26
27Pass a long as a parameter, containing the value of the permissions that are
28set on newly created files on the remote server. The default value is *0644*.
29The only protocols that can use this are *sftp://*, *scp://*, and *file://*.
30
31# DEFAULT
32
330644
34
35# PROTOCOLS
36
37SFTP, SCP and FILE
38
39# EXAMPLE
40
41~~~c
42int main(void)
43{
44  CURL *curl = curl_easy_init();
45  if(curl) {
46    CURLcode ret;
47    curl_easy_setopt(curl, CURLOPT_URL, "sftp://upload.example.com/file.txt");
48    curl_easy_setopt(curl, CURLOPT_NEW_FILE_PERMS, 0664L);
49    ret = curl_easy_perform(curl);
50  }
51}
52~~~
53
54# AVAILABILITY
55
56Added in 7.16.4
57
58# RETURN VALUE
59
60Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not.
61