Last active
June 27, 2020 12:15
-
-
Save binarymason/be003bbce617c471497efd28148e67a7 to your computer and use it in GitHub Desktop.
Revisions
-
binarymason revised this gist
Jun 27, 2020 . No changes.There are no files selected for viewing
-
binarymason created this gist
Jun 27, 2020 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,13 @@ uri = URI("#{ODM}/task/new/upload/#{oid}") request = Net::HTTP::Post.new(uri) form_data = [ ['images', attachment.tempfile, { filename: attachment.original_filename, content_type: attachment.content_type }] ] request.set_form form_data, 'multipart/form-data' response = Net::HTTP.start(uri.hostname, uri.port) do |http| # pay attention to use_ssl if you need it http.request(request) end JSON.parse(response.body)