I am trying to upload an image from iPhone to a Ruby on Rails (RoR) server, and I get the following error:
!\ FAILSAFE /!\ Thu Nov 11 23:51:39 CET 2010 Status: 500 Internal Server Error bad content body /usr/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/utils.rb:319:in `parse_multipart'
Linking to the RoR site works fine when I leave the line below, where I set the value for the line with multipart / form-data.
IPhone Code:
NSString *imagePath = [[NSBundle mainBundle] pathForResource:@"logo1" ofType:@"png"]; NSData *imageData = [NSData dataWithContentsOfFile:imagePath]; NSString *urlString = [NSString stringWithFormat:@"%@/user/iphone_results_to_website/", serverString ]; NSMutableURLRequest *imageRequest = [[[NSMutableURLRequest alloc] init] autorelease]; [imageRequest setURL:[NSURL URLWithString:urlString]]; [imageRequest setHTTPMethod:@"POST"]; NSString *boundary = [NSString stringWithString:@"--------------------------- 14737809831466499882746641449"];
On the RoR side, I have RMagick, ImageMagick and attachment_fu installed, and I set the photo model for attachment_fu as:
RoR Fashion Model:
class Photo < ActiveRecord::Base has_attachment :storage => :file_system, :resize_to => '640x480', :thumbnails => { :thumb => '160x120', :tiny => '50>' }, :max_size => 5.megabytes, :content_type => :image, :processor => 'Rmagick' validates_as_attachment belongs_to :user
Does anyone know what the problem is? Could the problem be in my Objective-C code or on the RoR side?
source share