151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
|
# File 'lib/cnvrg/files.rb', line 151
def upload_cnvrg_image(absolute_path, image_name,secret)
file_name = File.basename absolute_path
file_size = File.size(absolute_path).to_f
content_type = MimeMagic.by_path(absolute_path)
begin
upload_resp = Cnvrg::API.request("images/#{image_name}/upload", 'POST_FILE', {relative_path: absolute_path,
file_name: file_name,
file_size: file_size,
file_content_type: content_type,
secret:secret
})
if Cnvrg::CLI.is_response_success(upload_resp, false)
path = upload_resp["result"]["path"]
s3_res = upload_large_files_s3(upload_resp, absolute_path)
if s3_res
return true
else
return false
end
end
rescue => e
return false
end
return false
end
|