Debian Codegraph @

man/ftpUpload.Rd

raw
1 \name{ftpUpload}
2 \alias{ftpUpload}
3 \title{Upload content via FTP}
4 \description{
5 This function is a relatively simple wrapper for \code{\link{curlPerform}}
6 which allows the caller to upload a file to an FTP server.
7 One can upload the contents of a file from the local file system or
8 the contents already in memory.
9 One specifies the FTP server and the fully-qualified file name and path where the contents are
10 to be stored.
11 One can specify the user login and password via the \code{userpwd} option
12 for \code{\link{curlPerform}} via the \dots parameter, or
13 one can put this information directly in the target URL (i.e. \code{to})
14 in the form \code{ftp://login:[email protected]/path/to/file}.
15
16 This function can handle binary or text content.
17 }
18 \usage{
19 ftpUpload(what, to, asText = inherits(what, "AsIs") || is.raw(what),
20 ..., curl = getCurlHandle())
21 }
22 %- maybe also 'usage' for other objects documented here.
23 \arguments{
24 \item{what}{the name of a local file or the contents to be uploaded. This can
25 can be text or binary content. This can also be an open connection.
26 If this value is \code{raw} or has class \code{AsIs} by being enclosed within \code{I()},
27 it is treated as literal content.}
28 \item{to}{the URL to which the content is to be uploaded. This should be the ftp server
29 with the prefix \code{ftp://} and optionally the
30 user login and password, and then the path to the file in which the
31 content is to be stored.}
32 \item{asText}{a logical value indicating whether to treat the value of \code{what}
33 as content, be it text or raw/binary vector. Otherwise, \code{what} is
34 treated as the name of a file.}
35 \item{\dots}{additional arguments passed on to \code{\link{curlPerform}}.}
36 \item{curl}{the curl handle to use for the \code{\link{curlPerform}}}
37 }
38 \value{
39 The result of the \code{\link{curlPerform}} call.
40 }
41 \references{FTP, libcurl}
42 \author{Duncan Temple Lang}
43 \note{
44 One can also provide additional FTP commands that are executed
45 before and after the upload as part of the request.
46 Use the prequote, quote, and postquote options in \code{\link{curlPerform}} for these.
47 }
48 \seealso{
49 \code{\link{curlPerform}}
50 \code{\link{getCurlHandle}}
51 }
52 \examples{
53 \dontrun{
54
55 ftpUpload(I("Some text to be uploaded into a file\nwith several lines"),
56 "ftp://login:password@laptop17/ftp/zoe",
57 )
58
59 ftpUpload(I("Some text to be uploaded into a file\nwith several lines"),
60 "ftp://laptop17/ftp/zoe",
61 userpwd = "login:password"
62 )
63
64 ftpUpload(system.file("examples", "system.png", package = "RCurl"),
65 "ftp://login:password@laptop17/ftp/Election.rda",
66 postquote = c("CWD subdir", "RNFR Election.rda", "RNTO ElectionPolls.rda")
67 )
68 }
69 }
70 \keyword{IO}
71 \keyword{programming}