rejetto forum

Upload file with ruby programmatically

0 Members and 1 Guest are viewing this topic.

Offline scaryrawr

  • Occasional poster
  • *
    • Posts: 1
    • View Profile
So...  I was trying to figure this out all day, and I finally got it to work nicely.

gem install curb

require 'curb'
c = Curl::Easy.new('http://server/uploadpath')
c.multipart_form_post = true
c.http_post(Curl::PostField.file('fileupload1', '/path/to/file'), Curl::PostField.content('upbtn', 'Upload files'))

Since curl has other language bindings it should be similar for those too.


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13510
    • View Profile
you are just sharing your code, not asking anything, aren't you?