content = ""
file = @attachment.file_path
preview_file = "#{RAILS_ROOT}#{file}"
File.open("#{preview_file}", "rb") do |f|
f.each_line { |line| content += line }
end
logger.info "---------------file_name:"+file_name.to_s
send_data(content,:filename => file_name,:type => 'image/jpg',:disposition => 'inline')