0

I am new to Ruby and trying to post file from web app to another server using the code below but without any success - the file is not posted. How do to it correctly?

uri = URI("http://do.convertapi.com/word2pdf")
puts file_path
req = Net::HTTP::Post.new(uri.path)
req.set_form_data('file'=>file_path)
res = Net::HTTP.start(uri.hostname, uri.port) do |http|     
  http.request(req)      
end
Tomas
  • 17,551
  • 43
  • 152
  • 257

1 Answers1

0

Try this:

https://github.com/taf2/curb#http-post-file-upload

This is cURL lib in ruby.I used this many times and works very well.

GBD
  • 15,847
  • 2
  • 46
  • 50