I\'m trying to do file uploads with ruby 1.8 and it seems like there are no good out-of-the-box solutions. They all seem to need some 3rd party patch or fork of a project to
Looking at the underlying issue you are trying to solve. I was looking for a multpart-post client before and spent a lot of time trying out diffrent gems/tools. The only one i found that worked satisfactory was Nick Siegers multipart-post gem
It was very straightforward to use, I highly recommend it.
Here is sample code i made for my test
require "rubygems"
require 'net/http/post/multipart'
url = URI.parse('http://localhost:3000/mytest/1.xml')
File.open("c:/temp/readme.txt") do |jpg|
req = Net::HTTP::Put::Multipart.new url.path,
"mytest[attachment]" => UploadIO.new(jpg, "text/plain", "c:/temp/readme.txt")
res = Net::HTTP.start(url.host, url.port) do |http|
http.request(req)
end
puts res.inspect
end
Execute Below command and its works
gem install curb --platform=mswin32
Ultimately, in win7 with ruby 1.9.1 the following worked for me (where paths need to be updated to reflect the location (and version) of your curl version (which can be obtained via http://curl.haxx.se/download.html#Win32))
gem install curb -- --with-curl-lib="C:/curl/curl-7.21.1-devel-mingw32/bin" --with-curl-include="C:/curl/curl-7.21.1-devel-mingw32/include"
This did take a few minutes to process, so be patient.
When you say you passed configuration options to extconf.rb, did you mean in the gem install command?
If not, I believe it would be something along the lines of
gem install curb -- --with-curl-dir=dir
It might be a different config option, but the -- is that bit you need to pass it configure options.
For Windows 8 the command was:
gem install curb -- --with-curl-lib=C:/Utils/curl-7.32.0-dev/lib64 --with-curl-include=C:/Utils/curl-7.32.0-dev/include
And it nearly installs. Now there are "undefined reference" warnings/errors