File download in Rails

M

Mateusz Tybura

[Note: parts of this message were removed to make it a legal post.]

I've got problem with allow user to download file.

This is sending method:

class DownloadController < ApplicationController
def send
@headers["Content-Type"] =
("./public/files/"+params[:path]+"/"+params[:name]).content_type
send_file(("./public/files/"+params[:path]+"/"+params[:name]), :type =>
param[:name].content_type)
end
end

In view i have:

<%= link_to st, :controller => "download", :action => "send", :path => s,
:name => st %>

I get error:

Status: 500 Internal Server Error Content-Type: text/html 500 Internal
Server Error
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,069
Latest member
SimplyleanKetoReviews

Latest Threads

Top