ruby - How to give different filename to ftp file while downloading in rails -
i have:
1) files on ftp names (@track.path.path) "b573c8150fbc0dc6f5de6a9d4db79277_128.mp3" etc
2) in database each file has nice name (@track.fname) "u2_-_ill_go_crazy_if_i_dont_go_crazy_tonight.mp3"
question: there way give name db ftp file when downloading?
music_controller.rb:
def download @track = mp3file.find(params[:id]) case params[:bitrate] when "64" send_file(@track.path.path + "_128.mp3") when "128" send_file(@track.path.path + "_64.mp3") when "32" send_file(@track.path.path + "_32.mp3") end end i want user have nice name "u2_-_ill_go_crazy_if_i_dont_go_crazy_tonight.mp3" on device after downloading
send_file takes :filename alternative exactly this.
ruby-on-rails ruby ruby-on-rails-3 ruby-on-rails-3.2
No comments:
Post a Comment