File: ftpUpload.Rd

package info (click to toggle)
r-cran-rcurl 1.95-4.8-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 4,140 kB
  • ctags: 515
  • sloc: ansic: 3,135; xml: 1,734; asm: 993; sh: 12; makefile: 2
file content (71 lines) | stat: -rw-r--r-- 2,835 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
\name{ftpUpload}
\alias{ftpUpload}
\title{Upload content via FTP}
\description{
 This function is a relatively simple wrapper for \code{\link{curlPerform}}
 which allows the caller to upload a file to an FTP server.
 One can upload the contents of a file from the local file system or 
 the contents already in memory. 
 One specifies the FTP server and the fully-qualified file name and path where the contents are 
 to be stored.
 One can specify the user login and password via the \code{userpwd} option
 for  \code{\link{curlPerform}} via the \dots parameter, or
 one can put this information directly in the target URL (i.e. \code{to})
 in the form \code{ftp://login:password@machine.name/path/to/file}.

 This function can handle binary or text content.
}
\usage{
ftpUpload(what, to, asText = inherits(what, "AsIs") || is.raw(what),
          ..., curl = getCurlHandle())
}
%- maybe also 'usage' for other objects documented here.
\arguments{
  \item{what}{the name of a local file or the contents to be uploaded. This can 
    can be text or binary content. This can also be an open connection.
   If this value is \code{raw} or has class \code{AsIs} by being enclosed within \code{I()},
    it is treated as literal content.}
  \item{to}{the URL to which the content is to be uploaded. This should be the ftp server
    with the prefix \code{ftp://} and optionally the
     user login and password, and then the path to the file in which the 
     content is to be stored.}
  \item{asText}{a logical value indicating whether to treat the value of \code{what}
    as content, be it text or raw/binary vector.  Otherwise, \code{what} is 
    treated as the name of a file.}
  \item{\dots}{additional arguments passed on to \code{\link{curlPerform}}.}
  \item{curl}{the curl handle to use for the \code{\link{curlPerform}}}
}
\value{
 The result of the \code{\link{curlPerform}} call.
}
\references{FTP, libcurl}
\author{Duncan Temple Lang}
\note{
 One can also provide additional FTP commands that are executed
 before and after the upload as part of the request.
 Use the prequote, quote, and postquote options in \code{\link{curlPerform}} for these.
}
\seealso{
 \code{\link{curlPerform}}
 \code{\link{getCurlHandle}}
}
\examples{
 \dontrun{

  ftpUpload(I("Some text to be uploaded into a file\nwith several lines"),
            "ftp://login:password@laptop17/ftp/zoe",
            )

  ftpUpload(I("Some text to be uploaded into a file\nwith several lines"),
            "ftp://laptop17/ftp/zoe",
            userpwd = "login:password"
            )

  ftpUpload(system.file("examples", "system.png", package = "RCurl"), 
            "ftp://login:password@laptop17/ftp/Election.rda",
            postquote = c("CWD subdir", "RNFR Election.rda", "RNTO ElectionPolls.rda")
            )
 }
}
\keyword{IO}
\keyword{programming}