Katelynn ruan
Katelynn ruan

Reputation: 332

Rails how to provide file download not through controller?

I want to make a list of file download links to files in my local folder
when I use this
<a href="/home/tmpfile.txt">download_link</a>
It complains
No route matches [GET] "/home/tmpfile.txt"
and
<%=link_to "download_link","/home/tmpfile.txt"%>
also get
No route matches [GET] "/home/tmpfile.txt"
add get "/home/tmpfile.txt" to config/route.rb does not solve the problem

I dont want to use the send_file function in controller because I have a lot of files
I am looking for something like this
ftp://ftp.ncbi.nih.gov/pub/mmdb/cdd/

Does anyone have a simple solution?

Upvotes: 1

Views: 626

Answers (1)

davidb
davidb

Reputation: 8954

Is /home/tmpfile.txt the path in your filesystem or the path in the servers virtual filesystem? If its the path in the filesystem you need to move it to the public folder though its available in the webservers root directory!

Upvotes: 1

Related Questions