RestClient上传到亚马逊失败,出现InvalidArgument错误

时间:2012-02-16 10:59:31

标签: ruby-on-rails post amazon-s3 amazon-ec2 rest-client

我正在尝试通过POST请求将图像上传到亚马逊:

    begin
      RestClient.post('http://public.domain.com/',
                      {
                        :transfer => {
                          :key => s3_key,
                          :acl => s3_acl,
                          :content_type => s3_content_type,
                          :AWSAccessKeyId => s3_AWSAccessKeyId,
                          :policy => s3_policy,
                          :signature => s3_signature
                        },
                        :upload => {
                          :file =>  File.new('/tmp/uup_1114.png', 'rb')
                        }
                      })
    rescue => e
      render :text => e.response
    end

作为回应我正在

InvalidArgument
POST requires exactly one file upload per request.

RubyOnRails,RestClient。

1 个答案:

答案 0 :(得分:0)

请看这个答案:https://stackoverflow.com/a/9331205/1035438,这可以帮助您解决问题。