class FbPhotoUploader
  require 'net/http/post/multipart' # multipart-post gem
  require 'mime/types' #mime-types gem
  require 'net/https'

  def upload(path, access_token, options={})
    photo = File.open(path)
    params = {:access_token => access_token}
    params.merge!(options)
    url = URI.parse("https://graph.facebook.com/me/photos")

    req = Net::HTTP::Post::Multipart.new "#{url.path}?#{params.to_query}",
        "file" => UploadIO.new(photo, mime_for_file(photo), photo.path)

    n = Net::HTTP.new(url.host, url.port)
    n.use_ssl = true
    n.verify_mode = OpenSSL::SSL::VERIFY_NONE
    n.start do |http|
      http.request(req)
    end
  end

private
  def mime_for_file(f)
    m = MIME::Types.type_for(f.path.split('').last)
    m.empty? ? "application/octet-stream" : m.to_s
  end
end

This may save you some time if you're trying to post photos to fb photo albums with ruby.

Make sure you install the multipart-post and mime-types gems.

Credit to this post: stackoverflow.com/questions/184178/ruby-how-to-post-a-file-via-http-as-multipart-form-data/…