Hi everybody, I want to display a link for downloading image from database. def image @image = Classified.find(params[:id]) send_data @image.picture, :filename => "photo.jpg", :type => @image.content_type, :disposition => "attachment" end <%= image_tag (url_for({:action => ''image'', :id => @classified.id})) -%> But its still display the image only not displaying the link to download. I use both :disposition as "inline" and "attachment". But I cant get the link to download the image file. How is it possible. Please advice me. Regards, Veeraa -- Posted via 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 groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Take a look at send_data method. Use this method within a controller action to send the data for your image to the client browser. You will then connect your action to a regular hyperlink within your view in the normal way. On May 7, 10:20 am, Veera Sundaravel <rails-mailing-l...@andreas- s.net> wrote:> Hi everybody, > > I want to display a link for downloading image from database. > > def image > @image = Classified.find(params[:id]) > send_data @image.picture, :filename => "photo.jpg", > :type => @image.content_type, :disposition => "attachment" > > end > > <%= image_tag (url_for({:action => ''image'', > :id => @classified.id})) -%> > > But its still display the image only not displaying the link to > download. > > I use both :disposition as "inline" and "attachment". But I cant get the > link to download the image file. How is it possible. Please advice me. > > Regards, > Veeraa > > -- > Posted viahttp://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 groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Robert Walker wrote:> Take a look at send_data method. Use this method within a controller > action to send the data for your image to the client browser. You > will then connect your action to a regular hyperlink within your view > in the normal way. > > On May 7, 10:20 am, Veera Sundaravel <rails-mailing-l...@andreas-HI Robert, Thanks for your kind reply. Thanks a lot. By veeraa..... -- Posted via 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 groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---