Hi Folks, I''m new to Rails and working on a project where after the user logs in they can click on a link to download an exe file ( say for example the file is at http://test.com/test.exe). I want to keep the link to the exe file hidden. What are the best ways to implement this step. I was thinking about using the redirect to url but I have been getting an error saying that I cannot use two redirect''s in a function. Also, I was thinking of using NET:HTTP to use http request but I have no idea how to implement this. Thanks!! -- 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 -~----------~----~----~----~------~----~------~--~---
On Mar 25, 6:54 pm, Jay Dev <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Hi Folks, > > I''m new to Rails and working on a project where after the user logs in > they can click on a link to download an exe file ( say for example the > file is athttp://test.com/test.exe). I want to keep the link to the exe > file hidden. What are the best ways to implement this step. > > I was thinking about using the redirect to url but I have been getting > an error saying that I cannot use two redirect''s in a function. >redirect won''t hide the url> Also, I was thinking of using NET:HTTP to use http request but I have no > idea how to implement this.You could but it would block the mongrel for the entire time it took to download the file. What''s not clear from your example is whether this file is on your server or somewhere else. Fred --~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Thanks for the reply. The exe file is on another server. Thanks! Frederick Cheung wrote:> On Mar 25, 6:54�pm, Jay Dev <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote: >> Hi Folks, >> >> I''m new to Rails and working on a project where after the user logs in >> they can click on a link to download an exe file ( say for example the >> file is athttp://test.com/test.exe). I want to keep the link to the exe >> file hidden. What are the best ways to implement this step. >> >> I was thinking about using the redirect to url but I have been getting >> an error saying that I cannot use two redirect''s in a function. >> > > redirect won''t hide the url > >> Also, I was thinking of using NET:HTTP to use http request but I have no >> idea how to implement this. > > You could but it would block the mongrel for the entire time it took > to download the file. > > What''s not clear from your example is whether this file is on your > server or somewhere else. > > Fred-- 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On Mar 25, 7:11 pm, Jay Dev <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Thanks for the reply. > > The exe file is on another server. >OK. I was asking because if on the same server then things like X-Send- File or X-Accel-Redirect work very nicely. You certainly could use net/ http to get the file and then send the response to the user although for anything but the smallest of files you''ll need to start sending the data before you have grabbed all of it (because otherwise the user will get bored or the browser will time you out) and I''m not sure there''s a nice way of doing that in rails. Fred> Thanks! > > > > Frederick Cheung wrote: > > On Mar 25, 6:54 pm, Jay Dev <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote: > >> Hi Folks, > > >> I''m new to Rails and working on a project where after the user logs in > >> they can click on a link to download an exe file ( say for example the > >> file is athttp://test.com/test.exe). I want to keep the link to the exe > >> file hidden. What are the best ways to implement this step. > > >> I was thinking about using the redirect to url but I have been getting > >> an error saying that I cannot use two redirect''s in a function. > > > redirect won''t hide the url > > >> Also, I was thinking of using NET:HTTP to use http request but I have no > >> idea how to implement this. > > > You could but it would block the mongrel for the entire time it took > > to download the file. > > > What''s not clear from your example is whether this file is on your > > server or somewhere else. > > > Fred > > -- > 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
This is an example. I tried this below code but it blocks mongrel until the whole file is read which is over 500 MB. def download send_data(open(''http://mirrors.gigenet.com/ubuntu/intrepid/ubuntu-8.10-desktop-i386.iso'').read, :filename => ''ubuntu-8.10-desktop-i386.iso'' , :type => ''application/force-download'', :disposition => ''attachment'') end -- 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 -~----------~----~----~----~------~----~------~--~---
On Mar 26, 3:54 am, Jay Dev <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> This is an example. > > I tried this below code but it blocks mongrel until the whole file is > read which is over 500 MB. > > def download > send_data(open(''http://mirrors.gigenet.com/ubuntu/intrepid/ubuntu-8.10-desktop-i386.i..., > :filename => ''ubuntu-8.10-desktop-i386.iso'' , > :type => ''application/force-download'', > :disposition => ''attachment'') > end > -- > Posted viahttp://www.ruby-forum.com/.Try using send_file function :) http://apidock.com/rails/ActionController/Streaming/send_file --~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Jay Dev wrote:> Hi Folks, > > I''m new to Rails and working on a project where after the user logs in > they can click on a link to download an exe file ( say for example the > file is at http://test.com/test.exe). I want to keep the link to the exe > file hidden. What are the best ways to implement this step.You can make an expirable link à-la Rapidshare, and/or use X-Accel-Redirect provided by Nginx, we use the latter to stream VOD. -- 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---