ruby on rails - Send multiple files to a webservice -
i'm trying send multiple files webservice (and proceed, depending on response afterwards, that's not @ yet). following code sends 1 file:
def show ... conn = faraday.new(:url => 'webservice.abc' ) |faraday| faraday.request :multipart faraday.adapter :net_http end payload = { :files => faraday::uploadio.new("#{rails.root}/fileone.xml", 'application/xml') } conn.post 'http://webservice.abc', payload @output = response.body end
and i'm stuck, trying find way send 2 (or more) files @ once, necessary purpose of webservice compare these. seems when put them array, can't handled with. i'm looking way "bundle" files in order post them afterwards (as said before- works 1 file)
tyia time
thanks deepak,
gave me hint right direction. should :files[i], though- payload line question reads:
payload = { :files[0] => faraday::uploadio.new("#{rails.root}/fileone.xml", 'application/xml'), :files[1] => faraday::uploadio.new("#{rails.root}/filetwo.xml", 'application/xml')}
Comments
Post a Comment