Paweł K
2008-May-27 08:25 UTC
Generating file for download from controller method on demand
Hello I''d like to implement in my app functionality of generating text files for download (like excel files etc.) generated on demand (user clicks "download a copy" and rails app should generate it and let user download, or at least start downloading by user) Is there any possibility to do it as simple as possible? :) Best regards and thank you in advance for your responds Pawel K. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Thorsten Mueller
2008-May-27 08:54 UTC
Re: Generating file for download from controller method on d
that''s my controller code for downloading a pdf file generated in the method write_invoice_pdf with pdf-writer def pdf write_invoice_pdf send_file(File.join(PDF_PATH_INVOICES, "result.pdf"), :filename => ''result.pdf'', :disposition => ''attachment'', :type => ''application/pdf'') end that''s basically all to it. generate the file, store it ''somewhere'', PDF_PATH_INVOICES in that case defines the target folder and is set in development.rb. after that it needs only to be sent and the browser will open the dialog to ask if you want to open it or save to disk. -- 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 -~----------~----~----~----~------~----~------~--~---