Wednesday, May 9, 2012

Ruby: uploading image problem, getting Internal server error

Share at Facebook

There is one thing you need to remember while uploading image using Ruby. You have to read the file in binary mode. Otherwise for some server, you'll get Internal server error. I am giving you an example using the Ruby/Mechanize., "rb") do|binaryImage|
content ='',
:img => binaryImage,
:imgTitle => 'some title'

imgFile is the path to your image.
"rb" used inside file open for reading file as binary mode.

No comments: