Skip to content

Instantly share code, notes, and snippets.

@cutterkom
Created June 22, 2019 10:04
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cutterkom/652d8ab890857113bc795dd98248587e to your computer and use it in GitHub Desktop.
Save cutterkom/652d8ab890857113bc795dd98248587e to your computer and use it in GitHub Desktop.
Uploading a file to Nextcloud from R via webdav
library(httr)
# webdav target and login
dav <- "https://your-nextcloud.com/remote.php/webdav"
username <- "<username>"
password <- "<password>"
# the file to upload
img <- "image.png"
# create the url target of the file
url <- file.path(dav, img)
# webdav uses a PUT request to send a file to Nextcloud
PUT(url, authenticate(username, password), body = upload_file(file.path(img)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment