ruby on rails: audio/mp3 content header download
- by bandhunt
How do you set the headers for downloads in ruby/rails?
In php I'd set the header for an mp3 download like this:
header("Content-Transfer-Encoding: binary");
header("Content-type: audio/mp3");
header("Content-Disposition: attachment; filename=\"$songname.mp3\"");
header("Content-Length: " . $size);
@readfile("http://example.com/12345.mp3");
Seems like there should be an easy should an easy solution.
I did find this:
response.headers['Content-type'] = 'Content-type: audio/mp3'
But I'm not sure how/where the readfile would come into play and other headers.
Thanks!