[R] RCURL ftp upload - ASCII or Binary type?
Magnus Eriksson
magnus.eriksson at tfbank.se
Wed Sep 26 14:07:59 CEST 2012
I'm trying to upload a file using RCURL:s ftpUpload() to a ftp-server using the following command:
> ftpUpload("'VERY.ODD.FILE.NAME(+1)'",to="ftp://x.x.x.x/","' VERY.ODD.FILE.NAME(+1)'",userpwd="USER:PASSWORD")
OK
0
The file I'm trying to upload is a very simple text-file but with a bit weird filename. Note the ' on each side of the filename.
So the upload itself is successful but the receiver of the file tells me that the file I uploaded was of "Binary" type and that his system only accepts "ASCII". So the receiver can see the file but it contains only weird characters.
Surfing the web I found this:
http://www.webweaver.nu/html-tips/ascii-binary.shtml
and indeed, when I try filezilla (http://filezilla-project.org/) to do the same upload, there is a setting in filezilla: "Default transfer type" that can be set to "ASCII" or "Binary". The transfer works fine when using "ASCII" and has same error as in R when using "Binary".
My conclusion is that, for some reason, R uses "Binary" as "Transfer type" here, but it should be using "ASCII".
I have been looking at curlSetOpt() but .encoding is not the problem here.
Is there a way to change R:s "Transfer Type" from "Binary" to "ASCII" in this case? How?
System: windows 7
R version: 2.15.0
Thanks for your help
Best regards
Magnus Eriksson
More information about the R-help
mailing list