I am developing an iPhone app in Appcelerator Titanium. My app is communicating with an API that I build using Rails 3.
I want to be able to upload an image from the iPhone app to the API (and Amazon S3). I am using the gem called Paperclip. Along with the upload request I need to send the name of the file. But if I do it like below, the image_file_name is not recognized. What is wrong with the call?
In the App: http://pastie.org/1805065
In the API model: http://pastie.org/1805071
In the API controller: http://pastie.org/1805073
Output on the API server: http://pastie.org/1805078
Looks like in the API Controller the line:
@avatar = Avatar.new(params[:avatar])
Should read:
@avatar = Avatar.new(params[:image])
Explanation:
This conclusions was made by looking at the server log output from the API Server, and checking the Parameters hash for the name of the submitted image. Instead of it being named "avatar" as your controller was expecting, it appears to actually be named "image".