Skip to content

Instantly share code, notes, and snippets.

@i0rek
Created May 12, 2013
Embed
What would you like to do?
Demonstrate file upload with ethon.
require 'ethon'
def forge_easy(url, file)
easy = Ethon::Easy.new(url: url, upload: true)
easy.set_read_callback(file)
easy.infilesize = file.size
easy
end
multi = Ethon::Multi.new
multi.add(forge_easy("www.example.com", File.open(__FILE__)))
multi.perform
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment