I am using the send_file method to download a file. It works fine on my local machine. But it''s not working on the server - it returns a blank file. code: send_file Rails.root.join(''public'', ''uploads'') + (uploaded_file.original_filename + ".filtered") Please help. -- 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-/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.
try with send_data 2011/5/27 Sayuj Othayoth <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org>> I am using the send_file method to download a file. It works fine on my > local machine. But it''s not working on the server - it returns a blank > file. > > code: > > send_file Rails.root.join(''public'', ''uploads'') + > (uploaded_file.original_filename + ".filtered") > > Please help. > > -- > 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-/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. > >-- Mediouni Adel Tunis www.metal-tn.xooit.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-/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.
On Fri, May 27, 2011 at 10:00 AM, Sayuj Othayoth <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org>wrote:> I am using the send_file method to download a file. It works fine on my > local machine. But it''s not working on the server - it returns a blank > file. > > code: > > send_file Rails.root.join(''public'', ''uploads'') + > (uploaded_file.original_filename + ".filtered") >try doing: file = Rails.root.join(''public'', ''uploads'') + (uploaded_file.original_filename + ".filtered") puts "@@@@@@@@@@@@@ #{file}" send_file file make sure file is valid.> > Please help. > > -- > 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-/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. > >-- 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.
On Fri, May 27, 2011 at 10:00 PM, Sayuj Othayoth <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org>wrote:> I am using the send_file method to download a file. It works fine on my > local machine. But it''s not working on the server - it returns a blank > file. > > code: > > send_file Rails.root.join(''public'', ''uploads'') + > (uploaded_file.original_filename + ".filtered") > >if you''re using nginx or apache, you might want to look at http://stackoverflow.com/questions/3724853/rails-sends-0-byte-files-using-send-file> Please help. > > -- > 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-/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. > >-- ------------------------------------------------------------- visit my blog at http://jimlabs.heroku.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-/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.
On Fri, May 27, 2011 at 10:00 AM, Sayuj Othayoth <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org>wrote:> I am using the send_file method to download a file. It works fine on my > local machine. But it''s not working on the server - it returns a blank > file. > > code: > > send_file Rails.root.join(''public'', ''uploads'') + > (uploaded_file.original_filename + ".filtered") > >by the way it makes no sense to use send file here, since the file is in the pubic folder it can be served by the web server, if you were trying to implement some sort of authorization is not working and the file and be downloaded without authorization (unless you assign them in the web server). Use send file when the files are out of the reach of the web server or when if you want to control access to the file move out of the public folder. -- 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.