Welcome to Working With Rails

 

Discussion Forums

Discuss all things Ruby on Rails with perhaps the web's most vibrant group of Ruby on Rails enthusiasts.
problem with attachement_fu on sinatra with rails 3
1 Post
problem with attachement_fu on sinatra with rails 3

Hello experts, I need to upload an image from my local computer to a web server and store the location in a database using attachment_fu plugin I am trying to use attachement_fu plugin on sinatra..

When I'm posting request on sinatra.. including file params

then in log it showing posted params[:file] format in hash type.. like

{"uploaded_data"=> {:filename=>"user.JPG", :type=>"image/jpeg", :name=>"custom_thumbnail[uploaded_data]", :tempfile=>

#,

:head=>

"Content-Disposition: form-data;

name=\"custom_thumbnail[uploaded_data]\"; filename=\"user.JPG\"\r\nContent-Type: image/jpeg\r\n"}}

instead of as attachement_fu needs it request file params as like

{"uploaded_data"=> #>}

Due to above(first one) has type format attachement_fu is not supporting..

it showing errors like

undefined method 'content_type' and all other....

Any ideas..? on how to get this to change/access params format as normal format(like action_controller params)?

*NOTE- its working fine when I'm posting that request on any controller but not working in sinatra..

Thank you in advance

-Ganesh K

Person
Jruby, Ruby, Rails Programmer
Sign In To Rate Post
1 Post
Login to add your message