Ruby on Rails Wednesday, January 5, 2011

Hello experts,

I am trying to user 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=>
#<File:C:/DOCUME~1/Nishant/LOCALS~1/Temp/RackMultipart4072-15639>,
: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"=>
#<ActionDispatch::Http::UploadedFile:0x1434
@content_type="image/jpeg",
@headers=
"Content-Disposition: form-data;
name=\"custom_thumbnail[uploaded_data]\";
filename=\"user.JPG\"\r\nContent-Type: image/jpeg\r\n",
@original_filename="user.JPG",
@tempfile=
#<File:C:/DOCUME~1/Nishant/LOCALS~1/Temp/RackMultipart4072-15640>>}


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)?


Thank you in advance

-Ganesh K

--
Posted via http://www.ruby-forum.com/.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

No comments:

Post a Comment