Skip to content

ftp connections for uploading files

9 messages · Thomas Loridan, Gábor Csárdi, Brian Ripley +1 more

#
Hi all,

I would like to upload some plots I create wth R via ftp or something
similar but I don t really understand which command/syntax I should
use:
should I go for  make.socket + write.socket or try and create
environment variables like frp_proxy_user and then ftp my files? how?

many thanks for your help

Thomas
#
Try system() with curl or a decent ftp client (I don't see that package 
RCurl covers this, but it might despite its description only mentioning 
HTTP).  From 'man curl'

    curl offers a busload of useful tricks like proxy support, user authen-
    tication,  ftp upload, HTTP post, SSL connections, cookies, file trans-
    fer resume and more. As you will see below, the amount of features will
    make your head spin!

Ftp protocols (and there are more than one) are fiendishly complicated, 
especially if proxies are involved.

BTW, this is yet another case where knowing your OS would have helped 
give a more precise answer. See the posting guide.
On Thu, 8 Jan 2009, Thomas Loridan wrote:

            

  
    
#
Many thanks for that.
I am running R under windows and I am not sure what you mean by this curl?
Is'nt there a way to ftp via an intrinsic R function?

Thanks again

Thomas

2009/1/8 Prof Brian Ripley <ripley at stats.ox.ac.uk>:

  
    
#
On Thu, Jan 8, 2009 at 5:42 PM, Thomas Loridan <thomas.loridan at gmail.com> wrote:
http://curl.haxx.se/
That I don't know, perhaps some else does. You might want to double
check the RCurl package.

Gabor

  
    
#
On Thu, 8 Jan 2009, G?bor Cs?rdi wrote:

            
And it comes as standard on Mac OS X and many Linux distros.
(Generally people who fail to provide the requested information should 
expect to Google for themselves, not expect their helpers to do such 
basic research for them.)
Yes, I do know about 'intrinsic R', and did you think the author of the R 
Internet connectivity would not have said so if there was? (Also the 
person who provides the RCurl port for Windows.)

  
    
#
Prof Brian Ripley wrote:
It does support FTP, and all of the protocols that are supported in
the installed libcurl, so it depends the configuration options for 
libcurl itself.

The protocols it handles can be found via the curlVersion() function, e.g.

 > curlVersion()
$age
[1] 3

$version
[1] "7.16.3"

$vesion_num
[1] 462851

$host
[1] "powerpc-apple-darwin9.0"

$features
         ipv6          ssl         libz         ntlm gssnegotiate 
largefile
            1            4            8           16           32 
    512

$ssl_version
[1] " OpenSSL/0.9.7l"

$ssl_version_num
[1] 0

$libz_version
[1] "1.2.3"

$protocols
[1] "tftp"   "ftp"    "telnet" "dict"   "ldap"   "http"   "file"   "https"
[9] "ftps"

$ares
[1] ""

$ares_num
[1] 0

$libidn
[1] ""



sessionInfo()
R version 2.9.0 Under development (unstable) (2008-09-27 r46576)
i386-apple-darwin9.5.0

locale:
C

attached base packages:
[1] stats     graphics  grDevices datasets  utils     methods   base

other attached packages:
[1] ROOXML_0.1-0        Rcompression_0.4-0  RGoogleDocs_0.2-0
[4] SVGAnnotation_0.1-0 lattice_0.17-15     RCurl_0.92-0
[7] XML_1.99-0          RTools_0.1-0        bitops_1.0-4

loaded via a namespace (and not attached):
[1] grid_2.9.0
 >




 >  From 'man curl'
#
Thanks a lot Duncan

Sorry to insist with my questions but I am very lost with these Rcurl
commands...
could you point out the few ones I need to set up an ftp connection
and just upload a file ?

Greatly appreciated

Thomas

2009/1/8 Duncan Temple Lang <duncan at wald.ucdavis.edu>:

  
    
#
Hi Thomas

  Rather than getting into the details of libcurl options
which are quite general and very flexible, I thought
it was easier to write an explicit ftpUpload() function
that takes care of the details.

You need a new version of the package (as it contains the function and
a small change to the C code), but I don't have the time to build the 
Windows version for the next few days.

The function can be used as

   ftpUpload("path/to/file", "ftp://server/path/to/target/file",
              userpwd = "login:password")

and you can deal with contents in memory too rather than from a file.


  HTH,
    D.
Thomas Loridan wrote:
1 day later
#
On Fri, 9 Jan 2009, Duncan Temple Lang wrote:

            
One is on CRANextras now.