上载文件时RAmazonS3断管

时间:2013-06-16 15:15:46

标签: r amazon-s3

我正在尝试使用RAmazonS3将本地文件上传到S3存储空间,但我一直收到管道错误。

require(RAmazonS3)
options(AmazonS3 = c('xxx' = "xxx")) #login and secret
setwd('[local directory]/reports') #set working directory to location of "polarity.png"
addFile("polarity.png", "umusergen", "destination.png",type="image/png",meta = c(foo = 123, author = "Duncan Temple Lang"))
  

发送失败:管道损坏

如果我只是尝试上传内容

,它可以正常工作

addFile(I("This is a test"), "umusergen", "destination.png",type="text",meta = c(foo = 123, author = "Duncan Temple Lang")

1 个答案:

答案 0 :(得分:3)

除非另有说明,否则addFile()非常简单,并且专注于文本内容。 使用

 content = readBin("polarity.png", raw(), file.info("polarity.png")[1, "size"])

  addFile(content, "umusergen", "destination.png", type = "image/png")

我将更新addFile()函数以允许指示这是二进制或内容 或者使用(MIME)类型。