CURLOPT_NEW_FILE_PERMS.3 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. .\" generated by cd2nroff 0.1 from CURLOPT_NEW_FILE_PERMS.md
  2. .TH CURLOPT_NEW_FILE_PERMS 3 "2025-01-17" libcurl
  3. .SH NAME
  4. CURLOPT_NEW_FILE_PERMS \- permissions for remotely created files
  5. .SH SYNOPSIS
  6. .nf
  7. #include <curl/curl.h>
  8. CURLcode curl_easy_setopt(CURL *handle, CURLOPT_NEW_FILE_PERMS,
  9. long mode);
  10. .fi
  11. .SH DESCRIPTION
  12. Pass a long as a parameter, containing the value of the permissions that are
  13. set on newly created files on the remote server. The default value is \fI0644\fP.
  14. The only protocols that can use this are \fIsftp://\fP, \fIscp://\fP, and \fIfile://\fP.
  15. .SH DEFAULT
  16. 0644
  17. .SH PROTOCOLS
  18. This functionality affects file, scp and sftp
  19. .SH EXAMPLE
  20. .nf
  21. int main(void)
  22. {
  23. CURL *curl = curl_easy_init();
  24. if(curl) {
  25. CURLcode ret;
  26. curl_easy_setopt(curl, CURLOPT_URL, "sftp://upload.example.com/file.txt");
  27. curl_easy_setopt(curl, CURLOPT_NEW_FILE_PERMS, 0664L);
  28. ret = curl_easy_perform(curl);
  29. }
  30. }
  31. .fi
  32. .SH AVAILABILITY
  33. Added in curl 7.16.4
  34. .SH RETURN VALUE
  35. Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not.
  36. .SH SEE ALSO
  37. .BR CURLOPT_NEW_DIRECTORY_PERMS (3),
  38. .BR CURLOPT_UPLOAD (3)