Hi, In my application i have the facility for the users to upload the file which has code ... And when i want to view the contents of the file uploaded in my view,in case if the uploaded file is an html file then i am not able to display the exact code...Instead the html content in that code gets executed. if i have uploaded example.html <html> <head> <title>sample</title> </head> <body> <H1> Hello World </H1> </body></html> I want to display each line of this file in my view.But in my view when i use <% myfile= File.open(example.html)%> <ul> <% myfile.each do |line| %> <li> <%= line %></li> <% end%> </ul> the lines of the html file is getting executed and just HelloWorld is displayed without the entire code getting displayed. Can anybody help me on this? -- 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
> And when i want to view the contents of the file uploaded in my view,in > case if the uploaded file is an html file then i am not able to display > the exact code...Instead the html content in that code gets executed.I hope you try to filter the html code that people are injecting in your page. If not then you will be awarded the "the most stupid feature of the year" prize. -- 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
> <% myfile.each do |line| %> > <li> <%= line %></li>Solution :- <li> <%=h line %> >/li>> <% end%> > </ul>-- 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Siddick Ebramsha wrote:> <% myfile.each do |line| %> > <li> <%= line %></li>Solution :- <li> <%=h line %> </li>> <% end%> > </ul>-- 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Siddick Ebramsha wrote:> >> <% myfile.each do |line| %> >> <li> <%= line %></li> > > Solution :- > <li> <%=h line %> >/li> > >> <% end%> >> </ul>Thank You...It worked.. -- 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---