Hello everyone, I am struck with the problem of retrieving an image from database. I am using <%= form_tag_with_upload_progress({:action => ''update_plugin_content''}, { :begin => "new Effect.Appear(''loading'');", :finish => "do_finish(arguments[0]);new Effect.Fade(''loading'');", :name => "message_form"} )%> (This form_tag_with_upload_progress is a method of uploading image thru AJAX) for uploading the image into the database. Itz working properly. After uploading I am doing an Ajax.Updater for getting the new image from the database. Here the problem is the image is getting fetched from the browser cache. I have implemented the following to try to solve this problem. 1. I had added a random number to the URL so that every request that goes is a new URL and var url ''/preference/get_user_logo?plugin_preferences_id=''+plugin_preferences_id+"&"+new Date().getTime()+"="+new Date().getTime(); new Ajax.Updater(''uploaded_logo'',url, {asynchronous:true, evalScripts:true,onLoading:function(){replace_logo_with_loading(''uploaded_logo'',''ipolipo_loading'');},onComplete:function(request){replace_logo_with_loading(''ipolipo_loading'',''uploaded_logo'');get_response();}});return true; This did not work. 2. My friend who works in java had suggested to set the headers cache-control to "no-cache" so the full action became def get_user_logo plugin_preference_id = params[:plugin_preferences_id] user_logo = PluginPreference.find(plugin_preference_id) image_of_user_logo = user_logo.image @response.headers["Expires"] = 0 @response.headers["Pragma"] = "no-cache" @response.headers["Cache-Control"] = "no-cache" if user_logo.image == nil or image_of_user_logo.empty? #... code send a default image else send_data user_logo.image, :type => "image/png", :disposition => "inline" end end But this also did not work. 3. just as suggested in the rails CookBook <a href="http://manuals.rubyonrails.com/read/chapter/62" target="blank">http://manuals.rubyonrails.com/read/chapter/62</a> def image @photo = Photo.find(@params[''id'']) minTime = Time.rfc2822(@request.env["HTTP_IF_MODIFIED_SINCE"]) rescue nil if minTime and @photo.updated_at <= minTime # use cached version render_text '''', ''304 Not Modified'' else # send image @response.headers[''Content-Description''] = @photo.description @response.headers[''Last-Modified''] = @photo.updated_at.httpdate send_data @photo.data, :type => @photo.mimeType, :disposition => ''inline'' end end I had modified my action like that suggested. But the "Time.rfc2822(@request.env["HTTP_IF_MODIFIED_SINCE"]" comes as nil and "@photo.description" is not recognized i.e., not proceeding further and also not throwing exception. Is the "@request.env["HTTP_IF_MODIFIED_SINCE"]" needs to be set anywhere. If so where it has to be set? The problem is clearly with the browser cache. But I am unable to find the solution. Please help me in this . Thanks in advance... Regards, JazzyBuddy ................... -- 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 -~----------~----~----~----~------~----~------~--~---