Ive got an anchor link
<a href="http://bucket_name.amazonaws.com/uploads/users/4/songs/7/test.mp3">Download</a>
How do I make it so when a user clicks on it, it actually opens a popup asking the user to save the file instead of trying to play the file on the browser?
EDIT:
I was reading this article.
def download
data = open(Song.first.attachment)
send_data data.read, :type => data.content_type, :x_sendfile=>true
end
The article suggest using x_sendfile, since send_file takes up an http process with the potential risk of hanging the app until the download is completed.
Second, I am using send_data instead of send_file, which seems to work if the file is remote (i.e. hosted on Amazon S3). As suggested by this article.
The article, I mentioned was posted on 2009. Is x_sendfile=>true still necessary? Will it hang the app if it isn't included?
Should I really be using send_data or send_file?