# Automatically download file

**URL:** <https://www.ruby-forum.com/t/automatically-download-file/111926>\
**Category:** Rails\
**Created:** [August 13, 2007, 4:28pm UTC](https://www.ruby-forum.com/t/automatically-download-file/111926 "2007-08-13T16:28:19Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Eivind\_LSSSSland-An](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/59ef9b/32.png) [@Eivind\_LSSSSland-An](https://www.ruby-forum.com/u/Eivind_LSSSSland-An)\
**Post date:** [August 13, 2007, 4:28pm UTC](https://www.ruby-forum.com/t/automatically-download-file/111926/1 "2007-08-13T16:28:19Z")

</div>

Hi,

I’m trying to make a rails-application that checks out and downloads a  
file in a single click.  
The user should click on a file, and the application should download  
the file, update the database and display some results for instance  
“The file is checked out and downloaded”.

I realize this is two responses to a single request, and simply won’t  
work.

I’ve seen pages like versiontracker that redirects to a new page that  
pushes a file download from a javascript in the header. (?) Can  
something like this be done in a more “rails friendly way”?

I’m grateful for any tips!

Eivind
