Ruby - Uploading a file using RestClient post
问题 I have a cURL that I am trying to translate into Ruby. the cURL is this: curl -i -k -H "Accept: application/json" -H "Authorization: token" -H "Content-Type: image/jpeg" -H "Content-Length: 44062" --data-binary "gullfoss.jpg" http://www.someurl.com/objects My Ruby code is this: image = File.read('uploads/images/gullfoss.jpg') result = RestClient.post('http://www.someurl.com/objects',image,{'upload' => image, 'Accept' => 'application/json', 'Authorization' => 'token', 'Content-Type' => 'image