Method: Cnvrg::Datafiles#upload_small_files_s3
- Defined in:
- lib/cnvrg/datafiles.rb
#upload_small_files_s3(url_path, file_path, content_type) ⇒ Object
234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 |
# File 'lib/cnvrg/datafiles.rb', line 234 def upload_small_files_s3(url_path, file_path, content_type) url = URI.parse(url_path) file = File.open(file_path, "rb") body = file.read begin Net::HTTP.start(url.host) do |http| http.send_request("PUT", url.request_uri, body, { "content-type" => content_type, }) end return true rescue Interrupt return false rescue return false end end |