In your controller you have to read the input sent using the stdinput
attribute. The example below I'm using CURL to send an image to my
uploads_controller to simulate your REST webservice:
# Sending data via CURL
cat photo.jpg | curl -X POST -H 'Content-type: image/jpeg --data-
binary @- "
http://localhost:5000/uploads/create"
# Reading the content and storing to a file
class UploadsController < ApplicationController
def create
File.open("assets/photo.jpg", "wb") {|f| f <<
request.stdinput.read}
render :text => "image upload sent\n"
end
end
--
Thiago Jackiw
http://www.railsfreaks.com