I need a REST webservices, through which I can upload pictures from
a .NET client Desktop-Tool.
Here the “upload”-code-snipped from the .NET client tool:
…
Dim imageBytes() As Byte
imageBytes = ImageHelper.Image2ByteArray(image, format)
responseBytes = client.UploadData(url, “POST”, imageBytes)
…
Now my question is: how can i access the uploaded picture in my
Controller? Because there is no form and no fieldname for the picture
I don’t know how to access it…
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:
class UploadsController < ApplicationController
def create
File.open(“assets/photo.jpg”, “wb”) {|f| f <<
request.stdinput.read}
render :text => “image upload sent\n”
end
end