Ruby on Rails
Monday, May 30, 2011
On Fri, May 27, 2011 at 10:00 AM, Sayuj Othayoth <lists@ruby-forum.com> 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@googlegroups.com.
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.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment