3

マルチパートデータ(ファイル)をPOSTするサードパーティのWebサービスを使用しています。ただし、URLhttp ://ourdomain.com/theposturl ?extra=goodを介して追加のパラメーターも渡します。

バイナリデータの:filenameおよび:tempfileを含む'filename'オブジェクトはparams[]にあります

しかし、どのようにしてURLから「良い」ものを得るのでしょうか。

post /theposturl
  puts params.inspect    # this shows a hash with filename, 
                         # :filename and :tempfile as expected

  extra_param = ??????[:extra] # but what lets us 'read' the ?extra=good off the url

end
4

1 に答える 1

10

ハッシュキーとして文字列を使用する必要があります。

extra_param = params["extra"]
于 2011-02-16T22:39:05.837 に答える