ruby - Rails Form Image_Tag VS File_Field_tag -


i'm making profile picture user can either linkedin or upload it's own. when user get's linkedin it's shown via image_tag:

image_tag(base64::decode64(field_value), :alt => "profile_pic",:id => "profile_pic") 

but user can upload image:

file_field_tag("profile_pic") 

these code rendered apply_helper.rb:

def render_profile_image(field, alt, title)  if field.nil?   content_tag(:span, title) + tag(:br) + image_tag("user.png", :alt => alt) + tag(:br) +           \ file_field_tag("profile_pic") + tag(:br) + content_tag(:small, t("apply.create.labels.profile_pic")) + tag(:br)  else   field_value = field["value"]   content_tag(:span, title) + tag(:br) + image_tag(base64::decode64(field_value), :alt => "profile_pic",:id => "profile_pic") + tag(:br) + \     file_field_tag("profile_pic") + tag(:br) + content_tag(:small, t("apply.create.labels.profile_pic")) + tag(:br)  end end 

i hope clear until point, when apply , filled in good.

in apply controller: params["profile_pic"] shows content file_field_tag when remove , render image_tag can't seen values apply_controller.

i thank advise.

if use same name 2 different fields, they’re both going same name in params array. best use separate name both fields, example profile_pic , profile_pic_file_info.


Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -