Dear friends i have used send_file method to display my html file which is in my local server not in rails''s public folder <% @file_path = "#{@prfile.folder_path}/#{profile.file_path}" %> <%= link_to image_tag("configure.png",:title => "view profile"),{:action => "open_file",:file_path => @file_path},{:target => ''_new''} %> def open_file #-------------- @backup = ProfileBackup.find(:first) unlless @backup.nil? and params[:file_path].nil? file_path = params[:file_path] if File.exists?("#{file_path}") render :file => "#{file_path}", :layout => false end end end this works fine and open the file in the browser. but still it has not shown the image in the file. that image also in tat file path . but it has not shown the image... any helps -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Jan 9, 2:00 am, Newb Newb <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Dear friends > i have used send_file method to display my html file which is in my > local server not in rails''s public folder > > <% @file_path = "#...@prfile.folder_path}/#{profile.file_path}" %> > > <%= link_to image_tag("configure.png",:title => "view profile"),{:action > => "open_file",:file_path => @file_path},{:target => ''_new''} %> > > def open_file > #-------------- > @backup = ProfileBackup.find(:first) > unlless @backup.nil? and params[:file_path].nil? > file_path = params[:file_path] > if File.exists?("#{file_path}") > render :file => "#{file_path}", :layout => false > end > end > end > > this works fine and open the file in the browser. > but still it has not shown the image in the file. > that image also in tat file path . > but it has not shown the image... > any helpsIt''s hard to make out what you mean, so I''ll sum up what I *think* you''re asking: - you''ve got an HTML file someplace outside of RAILS_ROOT/public, that you render for the client when they request the open_file controller method. - images in that file don''t display. If that''s the case: of COURSE they aren''t going to display. The HTML file is returned, but the link to the image likely looks like this: <img src="some_image.png" /> What is the actual path that comes up in the address bar when you click on the link? I''d bet that it''s NOT: /controller_name/open_file/path/to/some/file as the file_path parameter is probably getting escaped... --Matt Jones -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Matt Jones wrote:> On Jan 9, 2:00 am, Newb Newb <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: >> #-------------- >> but still it has not shown the image in the file. >> that image also in tat file path . >> but it has not shown the image... >> any helps > > It''s hard to make out what you mean, so I''ll sum up what I *think* > you''re asking: > > - you''ve got an HTML file someplace outside of RAILS_ROOT/public, that > you render for the client when they request the open_file controller > method. > > - images in that file don''t display. > > If that''s the case: of COURSE they aren''t going to display. The HTML > file is returned, but the link to the image likely looks like this: > > <img src="some_image.png" /> > > What is the actual path that comes up in the address bar when you > click on the link? I''d bet that it''s NOT: > > /controller_name/open_file/path/to/some/file > > as the file_path parameter is probably getting escaped... > > --Matt JonesThanks for your reply. yes images in that file dont display <img src="MyCaptures/some_image.png"> the actual path that comes up in the address bar when click on the link is below controller_name/open_file/path/to/some/file Thanks in advance -- Posted via http://www.ruby-forum.com/. --0015174c3ff21706e7047cdaddac Content-Type: text/plain; charset=ISO-8859-1 -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en. --0015174c3ff21706e7047cdaddac--
Any Helps????????????? -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
2010/1/11 Newb Newb <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org>:>... > <img src="MyCaptures/some_image.png"> > the actual path that comes up in the address bar when > click on the link is below > controller_name/open_file/path/to/some/fileI have not studied the whole thread carefully but just looking at your link, that will expect to find a MyCaptures route. If the image is in a subfolder of public (which would be normal) then you need <img src="/MyCaptures/some_image.png">. Then it will expect the image to be in public/MyCaptures. Sorry if I have got the wrong end of the stick. Colin -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.