我正在尝试使用ruby 1.8进行文件上传,它似乎没有很好的开箱即用解决方案。他们似乎都需要某个项目的第三方补丁或分支才能工作。我会使用机械化,但我实际上需要与xml API进行接口,并且机械化似乎专门用于直接处理网页。我已经尝试了RestClient,但它没有为多部分表单开箱即用的功能,您必须使用项目的分支才能使其工作。对于Net似乎也有类似的情况:HTTP 我在想,因为我可能想要使用multicurl来处理其他一些我计划要做的事情,所以我认为应该是路由器。但是,在我的Windows机器上,我似乎无法安装路边宝石。 gem install curb给出了一个错误,说我需要指定curl库在哪里居住..我试过将选项传递给extconf,但目前为止没有运气。 这里是宝石的输出路边安装不带任何选项在Windows XP中安装Ruby Curb gem
C:\ruby\lib\ruby\gems\1.8\gems\curb-0.5.4.0>gem install curb
Building native extensions. This could take a while...
ERROR: Error installing curb:
ERROR: Failed to build gem native extension.
C:/ruby/bin/ruby.exe extconf.rb
checking for curl-config... no
checking for main() in curl.lib... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--srcdir=.
--curdir
--ruby=C:/ruby/bin/ruby
--with-curl-dir
--without-curl-dir
--with-curl-include
--without-curl-include=${curl-dir}/include
--with-curl-lib
--without-curl-lib=${curl-dir}/lib
--with-curllib
--without-curllib
extconf.rb:12: Can't find libcurl or curl/curl.h (RuntimeError)
Try passing --with-curl-dir or --with-curl-lib and --with-curl-include
options to extconf.
Gem files will remain installed in C:/ruby/lib/ruby/gems/1.8/gems/curb-0.5.4.0 for inspection.
Results logged to C:/ruby/lib/ruby/gems/1.8/gems/curb-0.5.4.0/ext/gem_make.out
任何想法如何,我能得到这个工作?
My最终的解决方案就是使用ruby rest-client,它完全支持文件上传。为了得到这个,只需将http://gems.github.com添加到你的源代码(如果你还没有的话),然后执行gem install rest-client 从那里你可以用你想要的多个字段/文件做多部分文章。 。这里的例子:http://rdoc.info/projects/archiloque/rest-client 这个客户端很棒,强烈推荐它。 – 2010-07-06 18:32:55