File download from server

Is there a way to retrieve a file off the server or hard drive? I
have a program that creates a file and I would like a button to
retrieve the file so the user can save it somewhere. Not ajax right
now.

Me wrote:

Is there a way to retrieve a file off the server or hard drive? I
have a program that creates a file and I would like a button to
retrieve the file so the user can save it somewhere. Not ajax right
now.

view

<%=button_to “Download File”, :action=>‘download’%>

controller

def download
send_file(path_to_file, :disposition => :attachment)
end

send_file documentation
http://railsmanual.org/module/ActionController::Streaming/send_file/1.1.2

I too had the same problem…thanks to @lake denman,ur solution solved
my
problem

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs