# Help on render file method

**URL:** <https://www.ruby-forum.com/t/help-on-render-file-method/181442>\
**Category:** Rails\
**Created:** [January 12, 2010, 3:56am UTC](https://www.ruby-forum.com/t/help-on-render-file-method/181442 "2010-01-12T03:56:49Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![newb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/2acd7d/32.png) [@newb](https://www.ruby-forum.com/u/newb)\
**Post date:** [January 12, 2010, 3:56am UTC](https://www.ruby-forum.com/t/help-on-render-file-method/181442/1 "2010-01-12T03:56:49Z")

</div>

Dear all,

kindly look at the below code

\<%= link\_to image\_tag(“backup\_configure.png”,:title =\> “view  
chat”),{:action =\> “open\_live\_file”,:file\_path =\> @file\_path},{:target  
=\> ‘\_new’} %\>

def open\_live\_file  
#--------------  
@backup = ChathistoryBackup.find(:first)

```
unless @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

when clicking on the above link it opens the html file on a browser  
window but it has not shown the images in the html file.

In my public folder

public/Server\_exe/ChatHistory/2010-01-10/2010-01-10\1~Vs~2\1~Vs~2.html  
=\> this is my live chat file path

for the above chat file images are in the following path

public/Server\_exe/ChatHistory/2010-01-10/1~Vs~2/ScreenCapture/2120100109101048121.jpg  
=\> this image is shown in the chat file

when rendering this file why the images are not shown even its all in  
public folder

i m running in to this issue for a past 2 days.

Kindly provide Ur advices on this issue

---

<div class="post-metadata">

**Author:** ![newb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/2acd7d/32.png) [@newb](https://www.ruby-forum.com/u/newb)\
**Post date:** [January 12, 2010, 10:52am UTC](https://www.ruby-forum.com/t/help-on-render-file-method/181442/2 "2010-01-12T10:52:14Z")

</div>

2010/1/12 Newb N. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> Â Â @backup = ChathistoryBackup.find(:first)
> 
> Â Â end
> 
> Â end
> 
> when clicking on the above link it opens the html file on a browser  
> window but it has not shown the images in the html file.

If you view the source in your browser what is shown for the image?  
Assuming it looks ok what happens if you copy the img src string and  
enter that directly in the browser.

If the html seems ok try copying the complete source of the page and  
pasting it into the html validator at  
[The W3C Markup Validation Service](http://validator.w3.org/#validate_by_input) to check the html is valid.

Colin
