redirect_to or send_file and AWS S3


I store files on S3 as the id of the file in my appliction. IE my file
with id 20 will be stored on S3 as 20. When I download the file I want
to look up the file name in the database and then pass it off to the
user. Is there any way I can use redirect_to and pass the S3 url and
then give it the filename, so the user doesn't get 20.

Does this make sense?



Yes: set the Content-Disposition header when you upload to S3.


Jeremy Kemper wrote:

The URL ends in 20, yes, but Content-Disposition: attachment;
filename="mypicture.jpg" tells the browser to download a file named

Do some googling on the topic and you'll find many others with the
same scenario and solution.