Sha256: 66c26998882c4c2734cd90ebd7e41bd0ad42d020c9722cb63646afd28dcf5461
Contents?: true
Size: 448 Bytes
Versions: 5
Compression:
Stored size: 448 Bytes
Contents
require 'net/http/post/multipart' module HTTPMultiPart def multipart_post(url, params = {}) unless params.has_key?(:file) post(url, params) end url = URI.parse(base_uri + url) req = Net::HTTP::Post::Multipart.new(url.path, { file: UploadIO.new(File.open(params[:file]), 'file'), body: params[:body] }) https = Net::HTTP.new(url.host, url.port) https.use_ssl = true https.request(req) end end
Version data entries
5 entries across 4 versions & 2 rubygems