Uchenna
Uchenna

Reputation: 4089

how to download file from filesystem in rails 3

I have a filesystem in my app where files are been uploaded via paperclip and i dont know how to download the uploaded files that have been saved in the file system. if i do something like this <%= link_to "Download", file.video.url %> it brings out the download dialog in mozilla but plays the video in google crome. When i hosted the app it behaves in another dimention, i checked my log file and i c this

Started GET "/system/audios/3/original/03%20Breakdown.mp3?1317217561" for 41.206.12.58 at 2011-09-28 14:18:13 -0700

ActionController::RoutingError (No route matches [GET] "/system/audios/3/original/03%20Breakdown.mp3"):

i dont know why this is hapenning.. is they a way i can do this by having a seprate download action.. if so i would like to know how. thank you(pls i am using paperclip for the upload)

Upvotes: 0

Views: 1251

Answers (1)

Dave Newton
Dave Newton

Reputation: 160171

Have you considered using send_file? It allows you to specify that the file is an attachment. The send_file would be in your download action.

Upvotes: 1

Related Questions