ruby - How do I PUT a file with Typheous? -
I am trying to send a file through a HTTP PUT request.
curl allows this type of:
http://curl.haxx.se/docs/httpscripting.html#PUT What is the correct way to do this with Typheous?
FWI is what I think was complete (but not necessarily at least) the question Answer:
Allows curl files to be uploaded w / PUT; Greetings:
$ curl --upload-file filename url While the url might look something like this:
http: //someurl/script.php? var = value & amp; anothervar = val & amp; ... Typhoeus provides the same functionality, but the file body has been buried in Ethon docs along with the correct method of going url, params and them:
request = typhos :: request New (URL ,: method =>: put: params => params_hash,: body => File.open (filename) {| io | io.read}) < p> Use the request object to get the response, etc.
Comments
Post a Comment