Uploading a file via POST with Net::HTTP

I've tried looking all over the place for some example of uploading a file
with Net:HTTP, but have finally given up and must ask for help.

Maybe this
is obvious or has been answered before (I tried searching the archives, but
the search form didn't seem to work for me).

Any help or pointers would
be appreciated.

Thanks,
Thomas

I haven't more than glanced at this (my stack keeps growing), but it may be what you are looking for:

Ruby Flickr Upload Script (by Bill Stilwell)

"The actual development of the script was fairly easy: ruby’s built in support for option parsing, YAML, and XML made things simple. The only irritating part was the HTTP POST of the image file, which I found is not supported by the ruby’s (otherwise excellent) standard http lib. (In case you think this an unreasonable expectation, perl does this.) A rousing bout of googling lead me to this*, which I used to extract a reasonably generic multipart/form-data helper class."

* http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/113774

James

···

thomaslockney.12367860@bloglines.com wrote:

I've tried looking all over the place for some example of uploading a file
with Net:HTTP, but have finally given up and must ask for help.

Maybe this
is obvious or has been answered before (I tried searching the archives, but
the search form didn't seem to work for me).

Any help or pointers would
be appreciated.

--

http://www.ruby-doc.org - The Ruby Documentation Site
http://www.rubyxml.com - News, Articles, and Listings for Ruby & XML
http://www.rubystuff.com - The Ruby Store for Ruby Stuff
http://www.jamesbritt.com - Playing with Better Toys