[Rails] Re: How to send audio files using net/http
HI All,
Got it working using the below script.
require 'net/http'
require "uri"
url = "http://#{domain}:#{port}"
uri = URI.parse(url);
data = File.read('fil_path') #File.read("/usr/test.amr")
http = Net::HTTP.new(uri.host, uri.port)
request = Net::HTTP::Post.new(uri.request_uri)
request.body = data
request.content_type = 'audio/amr'
res = http.request(request)
puts res.body
regards,
Loganathan
ViewMe
On Thu, Jun 21, 2012 at 11:47 AM, Loganathan Sellapa <loganathan.ms@gmail.com> wrote:
HI All,
I want to send audio file via http request as an api cal, not via form using net/http. I dont want to use any other gems. Please let me know how can be achieved.
regards,
Loganathan
ViewMe
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home