What API to use for uploading images to a Rails based website from an iPhone application?

681 views Asked by At

Looking at using either ObjectiveResource or ASIHTTPRequest ...

  1. Which is superior for uploading images? Or is there a better option???

  2. Are there any examples of using either or both to upload images (or any other binary content)?

Thanks

1

There are 1 answers

1
Alex Chugunov On BEST ANSWER

I haven't used ObjectiveResource. ASIHTTPRequest is fairly easy to use. You'll probably need multipart/form-data request, so there is a ASIFormDataRequest subclass for that. I had some problems with ASIFormDataRequest and Rails though. From what I remember, images in request were accompanied by "charset=some-encoding" parameter (and it was hardcoded), so Rails wouldn't accept it as a valid image when charset=utf8 was there. Another problem was, you couldn't have arrays (like array_item[]) in your POST requests. You simply couldn't add more than one parameter with the same name. But both problems are pretty easy to patch if you really want to use ASI framework. Take a look at http://allseeing-i.com/ASIHTTPRequest/How-to-use and at the comments in ASIFormDataRequest.h