2010/1/11 Newb Newb
<lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org>:> Dear all,
>
> I have a question which is driving me crazy
>
> Kindly look the below code
>
> 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
>
> <%= link_to image_tag("backup.png",:title => "view
> chat"),"/Server_exe/#{log.file_path}", :popup => true
%>
>
> when clicking on the above link i show the live(the files which are not
> moved to the archive location)chat files on a browser window these chat
> files are located in our rails applications public directory.this works
> just fine.that chat file can contain images with it.and this method
> properly opens a browser window and shows the chat file with images.in
> this case i don get any problem since it shows the chat file as it as
> they are.
>
> But when i move these chat files to the archived location i wil be
> running into the problem
>
> Archive location is D:/temp
>
> so these files wiil be moved to the above location when archive
> functionlity is taking place.
>
> Archived folder structure
>
> D:\Temp\ChatHistory\2010-01-10\2010-01-10\1~Vs~2\1~Vs~2.html => this is
> my archived chat file path
>
> D:\Temp\ChatHistory\2010-01-10\1~Vs~2\ScreenCapture\2120100109101048121.jpg
> => this image is shown in the chat file
>
> So to view the archived chat file from the archive location i use method
> like below...
>
> <%= link_to image_tag("backup.png",:title => "view
chat"),{:action =>
> "open_file",:file_path => @file_path},{:target =>
''_new''} %>
>
> def open_live_file
> #--------------
> @backup = Backup.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 the archived location i place the html files and corresponding images
> in the same folder only..
> In this case what is the way to display the html file with images with
> it ??
>
>
> And also to show live chat i just changed the code like below to test
> the render functionality
>
> <%= link_to image_tag("backup.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
>
> after the above changes it has opened the live chat file form the
> public folder but it has not shown the images .
> why this is so?? that images are only in the public folder then why it
> has not shown the chat file images when i used the above code..
> What i m missing or what i m doing wrong in my code ?
> Kindly let me know your Views on this..
Your question is too complex for me to fully understand without
spending a lot of time examining it, however your web server will not
be able to access files in d:/temp, if this is what you are trying to
do (unless you have the server setup in a strange way). Generally all
static files that wish to serve should stay under the public folder.
If this does not help have a look at the html that is not working and
see what is wrong with it.
If that still does not help simplify the problem to one that is more
easily understood and re-post.
Colin
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.