2012-02-16 77 views
1

我試圖通過POST請求上傳圖片到Amazon:RESTClient實現上傳到亞馬遜失敗,InvalidArgument錯誤

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實現。

+0

看起來在參數中存在一些錯誤。嘗試以不同的方式重寫你的代碼。 現在我得到了「Bucket POST必須包含一個名爲'key'的字段,如果指定了,請檢查字段的順序」。 – 2012-02-16 12:06:56

回答