ruby - How do I post/upload multiple files at once using HttpClient? -
def test_post_with_file filename = 'test01.xml' file.open(filename) |file| response = @http_client.post(url, {'documents'=>file}) end end
how modify above method handle multi-file-array post/upload?
file_array = ['test01.xml', 'test02.xml']
you mean this?
def test_post_with_file(file_array=[]) file_array.each |filename| file.open(filename) |file| response = @http_client.post(url, {'documents'=>file}) end end end
Comments
Post a Comment