Created
May 12, 2013 22:36
-
-
Save hanshasselberg/5565206 to your computer and use it in GitHub Desktop.
Demonstrate file upload with ethon.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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