Problem uploading html file to a ftpes server using Rcurl


I´m triying to upload a html file to a server via ftpes using Rcurl but I'm getting this error

rmd_path <- here::here("store", "store_data.Rmd")
html_path <- here::here("store", "store_data.html")
render(rmd_path, output_format = "html_document", output_options = c("self_contained = TRUE"), quiet = TRUE)
ftpUpload(html_path, "ftps://<user>:<password>@")
#> Error in function (type, msg, asError = TRUE)  : 
#>     gnutls_handshake() failed: An unexpected TLS packet was received.

This works just fine when TLS wasn't activated, but now I have configured TLS in the ftp server with a self signed certificate.


I finally found the solution, for curl to use explicit TLS on port 21 I have to use "ftp: //" prefix and ftp.ssl = TRUE option. And for curl to accept a self signed certificate, I have to add ssl.verifypeer = FALSE and ssl.verifyhost = FALSE options.

ftpUpload(html_path, "ftp://<user>:<password>@", ftp.ssl = TRUE, ssl.verifypeer = FALSE, ssl.verifyhost = FALSE)