1

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

halfer
  • 19,824
  • 17
  • 99
  • 186
Jonathan Clark
  • 19,726
  • 29
  • 111
  • 175
  • These links are dead for me, Pastie seems to be down. This highlights the importance of adding code/input/output into the question itself, rather than on paste boards. – halfer Apr 28 '17 at 22:24

1 Answers1

1

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".

Chris Cherry
  • 28,118
  • 6
  • 68
  • 71