MultiPart Form POST with curb
require 'curb'
c = Curl::Easy.new("http://localhost:3000/api/companies")
c.multipart_form_post = true
c.http_post(Curl::PostField.content('company[name]', "rajeev"),
Curl::PostField.content('company[rep_name]', "Awesome"),
Curl::PostField.content('company[rep_designation]', "daa"),
Curl::PostField.content('company[rep_image]', "my_id"),
Curl::PostField.content('company[company_large_logo]', "d"),
Curl::PostField.content('company[company_small_logo]', "sds"),
Curl::PostField.content('company[company_social_contacts]', "my_id"),
Curl::PostField.content('company[company_writeup]', "my_id"),
Curl::PostField.content('company[website]', "Some"),
Curl::PostField.content('company[active]', "1"),
Curl::PostField.file('logo_attributes', "spec/support/dogs.png"))
puts c.body_str
Written by Rajeev N Bharshetty
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Rails
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#